n8n-nodes-secret 1.0.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/LICENSE +46 -0
- package/README.md +453 -0
- package/dist/credentials/SecretApiCredentials.credentials.d.ts +7 -0
- package/dist/credentials/SecretApiCredentials.credentials.js +75 -0
- package/dist/credentials/SecretApiCredentials.credentials.js.map +1 -0
- package/dist/credentials/SecretNetworkCredentials.credentials.d.ts +8 -0
- package/dist/credentials/SecretNetworkCredentials.credentials.js +124 -0
- package/dist/credentials/SecretNetworkCredentials.credentials.js.map +1 -0
- package/dist/credentials/ViewingKeyCredentials.credentials.d.ts +7 -0
- package/dist/credentials/ViewingKeyCredentials.credentials.js +123 -0
- package/dist/credentials/ViewingKeyCredentials.credentials.js.map +1 -0
- package/dist/nodes/Secret/Secret.node.d.ts +5 -0
- package/dist/nodes/Secret/Secret.node.js +1221 -0
- package/dist/nodes/Secret/Secret.node.js.map +1 -0
- package/dist/nodes/Secret/SecretTrigger.node.d.ts +5 -0
- package/dist/nodes/Secret/SecretTrigger.node.js +484 -0
- package/dist/nodes/Secret/SecretTrigger.node.js.map +1 -0
- package/dist/nodes/Secret/constants/bridges.d.ts +57 -0
- package/dist/nodes/Secret/constants/bridges.js +142 -0
- package/dist/nodes/Secret/constants/bridges.js.map +1 -0
- package/dist/nodes/Secret/constants/contracts.d.ts +22 -0
- package/dist/nodes/Secret/constants/contracts.js +127 -0
- package/dist/nodes/Secret/constants/contracts.js.map +1 -0
- package/dist/nodes/Secret/constants/networks.d.ts +39 -0
- package/dist/nodes/Secret/constants/networks.js +58 -0
- package/dist/nodes/Secret/constants/networks.js.map +1 -0
- package/dist/nodes/Secret/constants/tokens.d.ts +18 -0
- package/dist/nodes/Secret/constants/tokens.js +100 -0
- package/dist/nodes/Secret/constants/tokens.js.map +1 -0
- package/dist/nodes/Secret/secret.svg +51 -0
- package/dist/nodes/Secret/transport/bridgeClient.d.ts +36 -0
- package/dist/nodes/Secret/transport/bridgeClient.js +200 -0
- package/dist/nodes/Secret/transport/bridgeClient.js.map +1 -0
- package/dist/nodes/Secret/transport/encryptionClient.d.ts +29 -0
- package/dist/nodes/Secret/transport/encryptionClient.js +132 -0
- package/dist/nodes/Secret/transport/encryptionClient.js.map +1 -0
- package/dist/nodes/Secret/transport/secretClient.d.ts +47 -0
- package/dist/nodes/Secret/transport/secretClient.js +201 -0
- package/dist/nodes/Secret/transport/secretClient.js.map +1 -0
- package/dist/nodes/Secret/transport/shadeClient.d.ts +35 -0
- package/dist/nodes/Secret/transport/shadeClient.js +258 -0
- package/dist/nodes/Secret/transport/shadeClient.js.map +1 -0
- package/dist/nodes/Secret/utils/encryptionUtils.d.ts +33 -0
- package/dist/nodes/Secret/utils/encryptionUtils.js +140 -0
- package/dist/nodes/Secret/utils/encryptionUtils.js.map +1 -0
- package/dist/nodes/Secret/utils/permitUtils.d.ts +35 -0
- package/dist/nodes/Secret/utils/permitUtils.js +157 -0
- package/dist/nodes/Secret/utils/permitUtils.js.map +1 -0
- package/dist/nodes/Secret/utils/unitConverter.d.ts +21 -0
- package/dist/nodes/Secret/utils/unitConverter.js +121 -0
- package/dist/nodes/Secret/utils/unitConverter.js.map +1 -0
- package/dist/nodes/Secret/utils/viewingKeyUtils.d.ts +21 -0
- package/dist/nodes/Secret/utils/viewingKeyUtils.js +123 -0
- package/dist/nodes/Secret/utils/viewingKeyUtils.js.map +1 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright (c) 2017 MariaDB Corporation Ab.
|
|
4
|
+
|
|
5
|
+
Licensor:
|
|
6
|
+
Velocity BPA, LLC
|
|
7
|
+
https://velobpa.com
|
|
8
|
+
|
|
9
|
+
Licensed Work:
|
|
10
|
+
This repository and all source code, documentation, and associated artifacts
|
|
11
|
+
contained herein, including all n8n community nodes published by Velocity BPA.
|
|
12
|
+
|
|
13
|
+
Additional Use Grant:
|
|
14
|
+
You may use, modify, and run the Licensed Work free of charge for:
|
|
15
|
+
- Personal use
|
|
16
|
+
- Educational use
|
|
17
|
+
- Research use
|
|
18
|
+
- Internal business use, provided such use does not involve resale,
|
|
19
|
+
redistribution, or offering the Licensed Work as part of a commercial
|
|
20
|
+
product or service.
|
|
21
|
+
|
|
22
|
+
Commercial Use Restriction:
|
|
23
|
+
Commercial Use of the Licensed Work is prohibited without a valid
|
|
24
|
+
Commercial License issued by the Licensor.
|
|
25
|
+
|
|
26
|
+
Commercial Use includes, but is not limited to:
|
|
27
|
+
- Use of the Licensed Work within any Software-as-a-Service (SaaS),
|
|
28
|
+
Platform-as-a-Service (PaaS), or hosted application that is sold,
|
|
29
|
+
licensed, or monetized in any form
|
|
30
|
+
- Offering the Licensed Work as part of a managed services engagement
|
|
31
|
+
- Bundling or redistributing the Licensed Work with a paid product
|
|
32
|
+
- Reselling, sublicensing, or white-labeling the Licensed Work
|
|
33
|
+
- Embedding the Licensed Work into any commercial automation platform,
|
|
34
|
+
integration product, or solution offering
|
|
35
|
+
|
|
36
|
+
Change Date:
|
|
37
|
+
January 1, 2030
|
|
38
|
+
|
|
39
|
+
Change License:
|
|
40
|
+
Apache License, Version 2.0
|
|
41
|
+
|
|
42
|
+
For commercial licensing inquiries:
|
|
43
|
+
licensing@velobpa.com
|
|
44
|
+
|
|
45
|
+
Business Source License 1.1 full text:
|
|
46
|
+
https://mariadb.com/bsl11/
|
package/README.md
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# n8n-nodes-secret
|
|
2
|
+
|
|
3
|
+
> [Velocity BPA Licensing Notice]
|
|
4
|
+
>
|
|
5
|
+
> This n8n node is licensed under the Business Source License 1.1 (BSL 1.1).
|
|
6
|
+
>
|
|
7
|
+
> Use of this node by for-profit organizations in production environments requires a commercial license from Velocity BPA.
|
|
8
|
+
>
|
|
9
|
+
> For licensing information, visit https://velobpa.com/licensing or contact licensing@velobpa.com.
|
|
10
|
+
|
|
11
|
+
A comprehensive n8n community node for **Secret Network** - the blockchain with privacy-preserving smart contracts. This package enables seamless integration of Secret Network operations into your n8n workflows, including encrypted smart contracts, private token operations, staking, IBC transfers, and DeFi integrations.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **🔒 Privacy-First**: Full support for Secret Network's encrypted smart contracts with viewing keys and permits
|
|
21
|
+
- **💰 SNIP-20 Tokens**: Complete private fungible token operations including transfers, allowances, and history
|
|
22
|
+
- **🖼️ SNIP-721 NFTs**: Private NFT operations, metadata queries, and ownership management
|
|
23
|
+
- **🏦 Staking**: Delegate, undelegate, redelegate, and claim rewards from validators
|
|
24
|
+
- **🌉 IBC Transfers**: Cross-chain transfers to Cosmos ecosystem chains via IBC protocol
|
|
25
|
+
- **🔗 Bridge Operations**: ETH/BSC bridge integrations for wrapped assets
|
|
26
|
+
- **📊 Shade Protocol**: DeFi operations including ShadeSwap, SILK stablecoin, and SHD governance
|
|
27
|
+
- **🔐 Viewing Keys & Permits**: Secure private data access with multiple authentication methods
|
|
28
|
+
- **⚡ Real-time Triggers**: Event-based workflow automation for blocks, transactions, and token transfers
|
|
29
|
+
- **🛡️ Security**: Code hash validation, encrypted inputs, and TEE protection
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### Community Nodes (Recommended)
|
|
34
|
+
|
|
35
|
+
1. Open your n8n instance
|
|
36
|
+
2. Go to **Settings** → **Community Nodes**
|
|
37
|
+
3. Click **Install a community node**
|
|
38
|
+
4. Enter `n8n-nodes-secret`
|
|
39
|
+
5. Click **Install**
|
|
40
|
+
|
|
41
|
+
### Manual Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Navigate to your n8n custom nodes directory
|
|
45
|
+
cd ~/.n8n/custom
|
|
46
|
+
|
|
47
|
+
# Clone the repository
|
|
48
|
+
git clone https://github.com/Velocity-BPA/n8n-nodes-secret.git
|
|
49
|
+
cd n8n-nodes-secret
|
|
50
|
+
|
|
51
|
+
# Install dependencies and build
|
|
52
|
+
npm install
|
|
53
|
+
npm run build
|
|
54
|
+
|
|
55
|
+
# Restart n8n
|
|
56
|
+
n8n start
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Development Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Extract the package
|
|
63
|
+
unzip n8n-nodes-secret.zip
|
|
64
|
+
cd n8n-nodes-secret
|
|
65
|
+
|
|
66
|
+
# Install dependencies
|
|
67
|
+
npm install
|
|
68
|
+
|
|
69
|
+
# Build the project
|
|
70
|
+
npm run build
|
|
71
|
+
|
|
72
|
+
# Create symlink to n8n custom nodes directory
|
|
73
|
+
mkdir -p ~/.n8n/custom
|
|
74
|
+
ln -s $(pwd) ~/.n8n/custom/n8n-nodes-secret
|
|
75
|
+
|
|
76
|
+
# Restart n8n
|
|
77
|
+
n8n start
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Docker Installation
|
|
81
|
+
|
|
82
|
+
Add to your `docker-compose.yml` volumes:
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
volumes:
|
|
86
|
+
- ~/.n8n:/home/node/.n8n
|
|
87
|
+
- /path/to/n8n-nodes-secret:/home/node/.n8n/custom/n8n-nodes-secret
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Credentials Setup
|
|
91
|
+
|
|
92
|
+
### Secret Network Credentials
|
|
93
|
+
|
|
94
|
+
Main credential for interacting with Secret Network.
|
|
95
|
+
|
|
96
|
+
| Field | Description | Required |
|
|
97
|
+
|-------|-------------|----------|
|
|
98
|
+
| Network | Select mainnet, testnet, local, or custom | Yes |
|
|
99
|
+
| Mnemonic Phrase | 24-word wallet mnemonic (BIP39) | Yes |
|
|
100
|
+
| HD Path | Derivation path (default: m/44'/529'/0'/0/0) | No |
|
|
101
|
+
| LCD Endpoint | Custom LCD/REST API endpoint | For custom |
|
|
102
|
+
| RPC Endpoint | Custom RPC endpoint | No |
|
|
103
|
+
| Chain ID | Custom chain ID | For custom |
|
|
104
|
+
|
|
105
|
+
### Viewing Key Credentials
|
|
106
|
+
|
|
107
|
+
For accessing private contract data.
|
|
108
|
+
|
|
109
|
+
| Field | Description | Required |
|
|
110
|
+
|-------|-------------|----------|
|
|
111
|
+
| Contract Address | SNIP-20/721 contract address | Yes |
|
|
112
|
+
| Viewing Key | Your viewing key for the contract | Yes |
|
|
113
|
+
|
|
114
|
+
### Secret API Credentials
|
|
115
|
+
|
|
116
|
+
For external API integrations.
|
|
117
|
+
|
|
118
|
+
| Field | Description | Required |
|
|
119
|
+
|-------|-------------|----------|
|
|
120
|
+
| API Endpoint | API base URL | Yes |
|
|
121
|
+
| API Key | Authentication key | If required |
|
|
122
|
+
|
|
123
|
+
## Resources & Operations
|
|
124
|
+
|
|
125
|
+
### Account (7 operations)
|
|
126
|
+
- **Get SCRT Balance**: Query native SCRT balance for any address
|
|
127
|
+
- **Get All Balances**: Query all token balances including IBC tokens
|
|
128
|
+
- **Get Account Info**: Retrieve account details including sequence number
|
|
129
|
+
- **Transfer SCRT**: Send native SCRT to another address
|
|
130
|
+
- **Validate Address**: Check if an address is valid Secret Network format
|
|
131
|
+
- **Get Delegations**: List all staking delegations for an address
|
|
132
|
+
- **Get Rewards**: Query pending staking rewards
|
|
133
|
+
|
|
134
|
+
### Transaction (4 operations)
|
|
135
|
+
- **Get Transaction**: Retrieve transaction details by hash
|
|
136
|
+
- **Get Status**: Check transaction confirmation status
|
|
137
|
+
- **Simulate**: Simulate transaction execution without broadcasting
|
|
138
|
+
- **Estimate Gas**: Calculate gas requirements for a transaction
|
|
139
|
+
|
|
140
|
+
### Contract (6 operations)
|
|
141
|
+
- **Get Contract Info**: Query contract metadata and code info
|
|
142
|
+
- **Get Code Hash**: Retrieve contract code hash for verification
|
|
143
|
+
- **Query (Public)**: Execute public contract queries
|
|
144
|
+
- **Query (Viewing Key)**: Query private data with viewing key
|
|
145
|
+
- **Execute Contract**: Execute contract messages with state changes
|
|
146
|
+
- **Get Contracts by Code ID**: List all instances of a contract code
|
|
147
|
+
|
|
148
|
+
### Privacy (5 operations)
|
|
149
|
+
- **Create Viewing Key**: Generate a new viewing key for a contract
|
|
150
|
+
- **Set Viewing Key**: Register a viewing key with a contract
|
|
151
|
+
- **Create Permit**: Generate a signed permit for authentication
|
|
152
|
+
- **Revoke Permit**: Revoke an existing permit
|
|
153
|
+
- **Query with Permit**: Execute queries using permit authentication
|
|
154
|
+
|
|
155
|
+
### SNIP-20 Token (9 operations)
|
|
156
|
+
- **Get Token Info**: Query token metadata (name, symbol, decimals)
|
|
157
|
+
- **Get Balance**: Query private token balance with viewing key
|
|
158
|
+
- **Transfer**: Transfer tokens to another address
|
|
159
|
+
- **Send**: Transfer with callback to recipient contract
|
|
160
|
+
- **Get Transfer History**: Query historical transfers
|
|
161
|
+
- **Set Viewing Key**: Create/update viewing key for token
|
|
162
|
+
- **Increase Allowance**: Approve spending by another address
|
|
163
|
+
- **Decrease Allowance**: Reduce approved spending amount
|
|
164
|
+
- **Get Allowance**: Check current allowance for spender
|
|
165
|
+
|
|
166
|
+
### SNIP-721 NFT (7 operations)
|
|
167
|
+
- **Get NFT Info**: Query NFT metadata and attributes
|
|
168
|
+
- **Get NFTs by Owner**: List all NFTs owned by an address
|
|
169
|
+
- **Transfer NFT**: Transfer NFT ownership
|
|
170
|
+
- **Send NFT**: Transfer with callback to recipient contract
|
|
171
|
+
- **Set Viewing Key**: Create viewing key for NFT contract
|
|
172
|
+
- **Approve**: Approve operator for NFT management
|
|
173
|
+
- **Revoke**: Revoke operator approval
|
|
174
|
+
|
|
175
|
+
### Staking (9 operations)
|
|
176
|
+
- **Get Validators**: List all active validators
|
|
177
|
+
- **Get Validator Info**: Query specific validator details
|
|
178
|
+
- **Delegate**: Stake SCRT with a validator
|
|
179
|
+
- **Undelegate**: Begin unbonding delegation (21-day period)
|
|
180
|
+
- **Redelegate**: Move delegation between validators
|
|
181
|
+
- **Get Delegations**: List your active delegations
|
|
182
|
+
- **Get Unbonding**: List pending unbonding delegations
|
|
183
|
+
- **Get Staking Rewards**: Query accumulated rewards
|
|
184
|
+
- **Claim Rewards**: Withdraw staking rewards
|
|
185
|
+
|
|
186
|
+
### IBC (4 operations)
|
|
187
|
+
- **IBC Transfer**: Cross-chain transfer via IBC protocol
|
|
188
|
+
- **Get Channels**: List available IBC channels
|
|
189
|
+
- **Get Channel Info**: Query specific channel details
|
|
190
|
+
- **Get Denom Trace**: Trace IBC token origin
|
|
191
|
+
|
|
192
|
+
### Block (4 operations)
|
|
193
|
+
- **Get Latest Block**: Query most recent block
|
|
194
|
+
- **Get Block by Height**: Query specific block by height
|
|
195
|
+
- **Get Chain ID**: Get current network chain ID
|
|
196
|
+
- **Get Network Status**: Check network health and sync status
|
|
197
|
+
|
|
198
|
+
### Utility (4 operations)
|
|
199
|
+
- **uscrt to SCRT**: Convert micro-units to SCRT (÷1,000,000)
|
|
200
|
+
- **SCRT to uscrt**: Convert SCRT to micro-units (×1,000,000)
|
|
201
|
+
- **Validate Address**: Verify address format
|
|
202
|
+
- **Get Network Info**: Get current connection details
|
|
203
|
+
|
|
204
|
+
## Trigger Node
|
|
205
|
+
|
|
206
|
+
The **Secret Network Trigger** node enables event-based workflow automation:
|
|
207
|
+
|
|
208
|
+
| Trigger Type | Description |
|
|
209
|
+
|--------------|-------------|
|
|
210
|
+
| New Block | Fires on each new block |
|
|
211
|
+
| SCRT Received | Fires when SCRT is received at watched address |
|
|
212
|
+
| SCRT Sent | Fires when SCRT is sent from watched address |
|
|
213
|
+
| Contract Executed | Fires when a specific contract is executed |
|
|
214
|
+
| Token Transfer (SNIP-20) | Fires on private token transfers (requires viewing key) |
|
|
215
|
+
| NFT Transfer (SNIP-721) | Fires on NFT transfers (requires viewing key) |
|
|
216
|
+
| Delegation Changed | Fires when delegation status changes |
|
|
217
|
+
| Rewards Available | Fires when rewards exceed threshold |
|
|
218
|
+
| IBC Transfer Received | Fires on incoming IBC transfers |
|
|
219
|
+
| Transaction Confirmed | Fires when specific transaction is confirmed |
|
|
220
|
+
|
|
221
|
+
## Usage Examples
|
|
222
|
+
|
|
223
|
+
### Get SCRT Balance
|
|
224
|
+
|
|
225
|
+
```javascript
|
|
226
|
+
// Resource: Account
|
|
227
|
+
// Operation: Get SCRT Balance
|
|
228
|
+
{
|
|
229
|
+
"address": "secret1abc...xyz"
|
|
230
|
+
}
|
|
231
|
+
// Returns: { "balance": "1000000", "denom": "uscrt", "formatted": "1.0 SCRT" }
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Transfer SCRT
|
|
235
|
+
|
|
236
|
+
```javascript
|
|
237
|
+
// Resource: Account
|
|
238
|
+
// Operation: Transfer SCRT
|
|
239
|
+
{
|
|
240
|
+
"recipient": "secret1recipient...",
|
|
241
|
+
"amount": "1.5",
|
|
242
|
+
"memo": "Payment for services"
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Query SNIP-20 Token Balance
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
// Resource: SNIP-20 Token
|
|
250
|
+
// Operation: Get Balance
|
|
251
|
+
{
|
|
252
|
+
"contractAddress": "secret1token...",
|
|
253
|
+
"viewingKey": "api_key_..."
|
|
254
|
+
}
|
|
255
|
+
// Returns: { "balance": "1000000000" }
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Create Viewing Key
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
// Resource: Privacy
|
|
262
|
+
// Operation: Create Viewing Key
|
|
263
|
+
{
|
|
264
|
+
"contractAddress": "secret1contract...",
|
|
265
|
+
"entropy": "random_string_for_key_generation"
|
|
266
|
+
}
|
|
267
|
+
// Returns: { "viewing_key": "api_key_..." }
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Delegate SCRT
|
|
271
|
+
|
|
272
|
+
```javascript
|
|
273
|
+
// Resource: Staking
|
|
274
|
+
// Operation: Delegate
|
|
275
|
+
{
|
|
276
|
+
"validatorAddress": "secretvaloper1...",
|
|
277
|
+
"amount": "100"
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### IBC Transfer to Osmosis
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
// Resource: IBC
|
|
285
|
+
// Operation: IBC Transfer
|
|
286
|
+
{
|
|
287
|
+
"sourceChannel": "channel-1",
|
|
288
|
+
"receiver": "osmo1recipient...",
|
|
289
|
+
"amount": "10",
|
|
290
|
+
"denom": "uscrt"
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Monitor Token Transfers (Trigger)
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
// Node: Secret Network Trigger
|
|
298
|
+
// Trigger On: Token Transfer (SNIP-20)
|
|
299
|
+
{
|
|
300
|
+
"contractAddress": "secret1token...",
|
|
301
|
+
"viewingKey": "your_viewing_key",
|
|
302
|
+
"watchAddress": "secret1youraddress..."
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Secret Network Concepts
|
|
307
|
+
|
|
308
|
+
### Viewing Keys
|
|
309
|
+
|
|
310
|
+
Viewing keys are user-generated passwords that allow querying private contract data. Each user creates their own viewing key for each contract they interact with.
|
|
311
|
+
|
|
312
|
+
```javascript
|
|
313
|
+
// Creating a viewing key
|
|
314
|
+
const result = await contract.execute({
|
|
315
|
+
create_viewing_key: { entropy: "random_string" }
|
|
316
|
+
});
|
|
317
|
+
// Result: { viewing_key: "api_key_..." }
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Permits
|
|
321
|
+
|
|
322
|
+
Permits are signed messages that provide temporary authentication without storing keys on-chain. They can have expiration times and limited permissions.
|
|
323
|
+
|
|
324
|
+
```javascript
|
|
325
|
+
// Permit structure
|
|
326
|
+
{
|
|
327
|
+
"params": {
|
|
328
|
+
"permit_name": "my_permit",
|
|
329
|
+
"allowed_tokens": ["secret1token..."],
|
|
330
|
+
"chain_id": "secret-4",
|
|
331
|
+
"permissions": ["balance", "history"]
|
|
332
|
+
},
|
|
333
|
+
"signature": "..."
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Code Hash Validation
|
|
338
|
+
|
|
339
|
+
Every Secret Network contract has a code hash that must be verified to prevent interacting with malicious contracts:
|
|
340
|
+
|
|
341
|
+
```javascript
|
|
342
|
+
// Always verify code hash before interaction
|
|
343
|
+
const expectedHash = "abc123...";
|
|
344
|
+
const actualHash = await client.query.compute.codeHashByContractAddress(address);
|
|
345
|
+
if (actualHash !== expectedHash) {
|
|
346
|
+
throw new Error("Code hash mismatch - possible malicious contract");
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
## Networks
|
|
351
|
+
|
|
352
|
+
| Network | Chain ID | LCD Endpoint |
|
|
353
|
+
|---------|----------|--------------|
|
|
354
|
+
| Mainnet | secret-4 | https://lcd.secret.express |
|
|
355
|
+
| Testnet | pulsar-3 | https://api.pulsar.scrttestnet.com |
|
|
356
|
+
| Local | secretdev-1 | http://localhost:1317 |
|
|
357
|
+
|
|
358
|
+
## Error Handling
|
|
359
|
+
|
|
360
|
+
The node includes comprehensive error handling:
|
|
361
|
+
|
|
362
|
+
| Error | Cause | Solution |
|
|
363
|
+
|-------|-------|----------|
|
|
364
|
+
| Invalid viewing key | Wrong or expired key | Create new viewing key |
|
|
365
|
+
| Out of gas | Insufficient gas limit | Increase gas in options |
|
|
366
|
+
| Account sequence mismatch | Rapid transactions | Wait and retry |
|
|
367
|
+
| Code hash mismatch | Contract verification failed | Verify contract address |
|
|
368
|
+
| Network error | Connection issues | Check endpoint accessibility |
|
|
369
|
+
|
|
370
|
+
## Security Best Practices
|
|
371
|
+
|
|
372
|
+
1. **Never share mnemonics**: Store securely in n8n credentials
|
|
373
|
+
2. **Rotate viewing keys**: Periodically create new viewing keys
|
|
374
|
+
3. **Use permits wisely**: Set appropriate expiration times
|
|
375
|
+
4. **Validate code hashes**: Always verify before contract interaction
|
|
376
|
+
5. **Test on testnet**: Use pulsar-3 before mainnet operations
|
|
377
|
+
6. **Secure credentials**: Use n8n's built-in credential encryption
|
|
378
|
+
7. **Monitor transactions**: Set up alerts for unexpected activity
|
|
379
|
+
|
|
380
|
+
## Development
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
# Install dependencies
|
|
384
|
+
npm install
|
|
385
|
+
|
|
386
|
+
# Build the project
|
|
387
|
+
npm run build
|
|
388
|
+
|
|
389
|
+
# Run in watch mode
|
|
390
|
+
npm run dev
|
|
391
|
+
|
|
392
|
+
# Run linting
|
|
393
|
+
npm run lint
|
|
394
|
+
|
|
395
|
+
# Fix linting issues
|
|
396
|
+
npm run lint:fix
|
|
397
|
+
|
|
398
|
+
# Run tests
|
|
399
|
+
npm test
|
|
400
|
+
|
|
401
|
+
# Run tests with coverage
|
|
402
|
+
npm run test:coverage
|
|
403
|
+
|
|
404
|
+
# Type checking
|
|
405
|
+
npm run typecheck
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## Author
|
|
409
|
+
|
|
410
|
+
**Velocity BPA**
|
|
411
|
+
- Website: [velobpa.com](https://velobpa.com)
|
|
412
|
+
- GitHub: [Velocity-BPA](https://github.com/Velocity-BPA)
|
|
413
|
+
- Email: licensing@velobpa.com
|
|
414
|
+
|
|
415
|
+
## Licensing
|
|
416
|
+
|
|
417
|
+
This n8n community node is licensed under the **Business Source License 1.1**.
|
|
418
|
+
|
|
419
|
+
### Free Use
|
|
420
|
+
Permitted for personal, educational, research, and internal business use.
|
|
421
|
+
|
|
422
|
+
### Commercial Use
|
|
423
|
+
Use of this node within any SaaS, PaaS, hosted platform, managed service,
|
|
424
|
+
or paid automation offering requires a commercial license.
|
|
425
|
+
|
|
426
|
+
For licensing inquiries:
|
|
427
|
+
**licensing@velobpa.com**
|
|
428
|
+
|
|
429
|
+
See [LICENSE](LICENSE), [COMMERCIAL_LICENSE.md](COMMERCIAL_LICENSE.md), and [LICENSING_FAQ.md](LICENSING_FAQ.md) for details.
|
|
430
|
+
|
|
431
|
+
## Contributing
|
|
432
|
+
|
|
433
|
+
Contributions are welcome! Please ensure:
|
|
434
|
+
|
|
435
|
+
1. Code follows the existing style (run `npm run lint`)
|
|
436
|
+
2. All tests pass (`npm test`)
|
|
437
|
+
3. New features include tests
|
|
438
|
+
4. Documentation is updated
|
|
439
|
+
5. Commits follow conventional commit format
|
|
440
|
+
|
|
441
|
+
## Support
|
|
442
|
+
|
|
443
|
+
- **Documentation**: [Secret Network Docs](https://docs.scrt.network/)
|
|
444
|
+
- **Issues**: [GitHub Issues](https://github.com/Velocity-BPA/n8n-nodes-secret/issues)
|
|
445
|
+
- **Discussions**: [GitHub Discussions](https://github.com/Velocity-BPA/n8n-nodes-secret/discussions)
|
|
446
|
+
- **n8n Community**: [n8n Community Forum](https://community.n8n.io/)
|
|
447
|
+
|
|
448
|
+
## Acknowledgments
|
|
449
|
+
|
|
450
|
+
- [Secret Network](https://scrt.network/) - The privacy-first blockchain
|
|
451
|
+
- [SecretJS](https://github.com/scrtlabs/secret.js) - Official JavaScript SDK
|
|
452
|
+
- [n8n](https://n8n.io/) - Workflow automation platform
|
|
453
|
+
- [Shade Protocol](https://shadeprotocol.io/) - DeFi on Secret Network
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SecretApiCredentials = void 0;
|
|
4
|
+
class SecretApiCredentials {
|
|
5
|
+
name = 'secretApiCredentials';
|
|
6
|
+
displayName = 'Secret API Credentials';
|
|
7
|
+
documentationUrl = 'https://docs.scrt.network/';
|
|
8
|
+
properties = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'API Service',
|
|
11
|
+
name: 'apiService',
|
|
12
|
+
type: 'options',
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Secret API (Official)',
|
|
16
|
+
value: 'secretApi',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Mintscan API',
|
|
20
|
+
value: 'mintscan',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'SecretNodes.com API',
|
|
24
|
+
value: 'secretNodes',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Custom API',
|
|
28
|
+
value: 'custom',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
default: 'secretApi',
|
|
32
|
+
description: 'The API service to connect to',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'API Endpoint',
|
|
36
|
+
name: 'apiEndpoint',
|
|
37
|
+
type: 'string',
|
|
38
|
+
default: '',
|
|
39
|
+
placeholder: 'https://api.example.com',
|
|
40
|
+
description: 'The API endpoint URL',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
apiService: ['custom'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
displayName: 'API Key',
|
|
49
|
+
name: 'apiKey',
|
|
50
|
+
type: 'string',
|
|
51
|
+
typeOptions: {
|
|
52
|
+
password: true,
|
|
53
|
+
},
|
|
54
|
+
default: '',
|
|
55
|
+
description: 'API key for authentication (if required)',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Mintscan API Key',
|
|
59
|
+
name: 'mintscanApiKey',
|
|
60
|
+
type: 'string',
|
|
61
|
+
typeOptions: {
|
|
62
|
+
password: true,
|
|
63
|
+
},
|
|
64
|
+
default: '',
|
|
65
|
+
description: 'Mintscan API key for enhanced access',
|
|
66
|
+
displayOptions: {
|
|
67
|
+
show: {
|
|
68
|
+
apiService: ['mintscan'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
exports.SecretApiCredentials = SecretApiCredentials;
|
|
75
|
+
//# sourceMappingURL=SecretApiCredentials.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecretApiCredentials.credentials.js","sourceRoot":"","sources":["../../credentials/SecretApiCredentials.credentials.ts"],"names":[],"mappings":";;;AAgBA,MAAa,oBAAoB;IAChC,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG,wBAAwB,CAAC;IACvC,gBAAgB,GAAG,4BAA4B,CAAC;IAEhD,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,uBAAuB;oBAC7B,KAAK,EAAE,WAAW;iBAClB;gBACD;oBACC,IAAI,EAAE,cAAc;oBACpB,KAAK,EAAE,UAAU;iBACjB;gBACD;oBACC,IAAI,EAAE,qBAAqB;oBAC3B,KAAK,EAAE,aAAa;iBACpB;gBACD;oBACC,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,QAAQ;iBACf;aACD;YACD,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,+BAA+B;SAC5C;QACD;YACC,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,yBAAyB;YACtC,WAAW,EAAE,sBAAsB;YACnC,cAAc,EAAE;gBACf,IAAI,EAAE;oBACL,UAAU,EAAE,CAAC,QAAQ,CAAC;iBACtB;aACD;SACD;QACD;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,0CAA0C;SACvD;QACD;YACC,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,sCAAsC;YACnD,cAAc,EAAE;gBACf,IAAI,EAAE;oBACL,UAAU,EAAE,CAAC,UAAU,CAAC;iBACxB;aACD;SACD;KACD,CAAC;CACF;AAtED,oDAsEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class SecretNetworkCredentials implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
test: ICredentialTestRequest;
|
|
8
|
+
}
|