@pipedream/overledger 0.0.1 → 0.2.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 +11 -0
- package/actions/execute-signed-transaction/execute-signed-transaction.mjs +45 -0
- package/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs +83 -0
- package/actions/read-from-a-smart-contract/read-from-a-smart-contract.mjs +86 -0
- package/actions/sign-a-transaction/sign-a-transaction.mjs +75 -0
- package/common/constants.mjs +71 -0
- package/common/utils.mjs +18 -0
- package/overledger.app.mjs +83 -5
- package/package.json +4 -1
- package/sources/common/base.mjs +74 -0
- package/sources/new-contract-event-instant/new-contract-event-instant.mjs +35 -0
- package/sources/new-contract-event-instant/test-event.mjs +24 -0
- package/sources/watch-new-account-event-instant/test-event.mjs +10 -0
- package/sources/watch-new-account-event-instant/watch-new-account-event-instant.mjs +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The Overledger API by Quant Network allows developers to interact with multiple blockchain networks. It facilitates the creation, reading, and execution of smart contracts and transactions across different blockchains. This API simplifies the complex nature of blockchain interoperability, enabling multi-chain applications (MApps) through a single gateway.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Automated Multi-chain Financial Reporting**: Build a workflow on Pipedream that triggers monthly, pulling transaction data from various blockchains via the Overledger API. Integrate this data with Google Sheets or a similar app on Pipedream to generate consolidated financial reports.
|
|
8
|
+
|
|
9
|
+
- **Cross-Blockchain Event Monitoring**: Set up a Pipedream workflow to monitor specific events (like transactions or smart contract interactions) across multiple blockchains using Overledger. This can trigger notifications via Slack or email when predefined conditions are met, such as unusual transaction volumes or large transfers.
|
|
10
|
+
|
|
11
|
+
- **Decentralized Application (DApp) Management**: Develop a workflow in Pipedream that utilizes Overledger to deploy and manage smart contracts across different blockchains. The workflow could, for instance, automatically update or verify contracts on Ethereum and Binance Smart Chain when a GitHub repository is updated, using a combination of Overledger and GitHub triggers on Pipedream.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import overledger from "../../overledger.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "overledger-execute-signed-transaction",
|
|
5
|
+
name: "Execute Signed Transaction",
|
|
6
|
+
description: "Executes a signed transaction by sending it to a blockchain node via Overledger. [See the documentation](https://developers.quant.network/reference/executesignedrequest)",
|
|
7
|
+
version: "0.0.2",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
overledger,
|
|
11
|
+
environment: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
overledger,
|
|
14
|
+
"environment",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
requestId: {
|
|
18
|
+
type: "string",
|
|
19
|
+
label: "Request ID",
|
|
20
|
+
description: "The Overledger identifier assigned to the related transaction preparation request. This should be set to the requestId parameter found in the response object of the 'Prepare a Smart Contract Transaction' Overledger action.",
|
|
21
|
+
},
|
|
22
|
+
signedTransaction: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "Signed Transaction",
|
|
25
|
+
description: "The raw transaction bytecode after signing. This should be set to the signed parameter found in the response object of the 'Sign a Transaction' Overledger action.",
|
|
26
|
+
optional: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
async run({ $ }) {
|
|
30
|
+
|
|
31
|
+
const requestBody = {
|
|
32
|
+
requestId: this.requestId,
|
|
33
|
+
signedTransaction: this.signedTransaction,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const response = await this.overledger.executeSignedTransaction({
|
|
37
|
+
$,
|
|
38
|
+
environment: this.environment,
|
|
39
|
+
data: requestBody,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
$.export("$summary", `Successfully executed signed transaction with Request ID ${this.requestId}`);
|
|
43
|
+
return response;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NETWORK_OPTIONS, TECHNOLOGY_OPTIONS,
|
|
3
|
+
} from "../../common/constants.mjs";
|
|
4
|
+
import { parseObject } from "../../common/utils.mjs";
|
|
5
|
+
import overledger from "../../overledger.app.mjs";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
key: "overledger-prepare-smart-contract-transaction",
|
|
9
|
+
name: "Prepare Smart Contract Transaction",
|
|
10
|
+
description: "Prepares a smart contract transaction for signing on the Overledger platform. [See the documentation](https://developers.quant.network/reference/preparesmartcontractwrite)",
|
|
11
|
+
version: "0.0.2",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
overledger,
|
|
15
|
+
environment: {
|
|
16
|
+
propDefinition: [
|
|
17
|
+
overledger,
|
|
18
|
+
"environment",
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
locationTechnology: {
|
|
22
|
+
type: "string",
|
|
23
|
+
label: "Location Technology",
|
|
24
|
+
description: "The technology of the blockchain that the transaction will be submitted to",
|
|
25
|
+
options: TECHNOLOGY_OPTIONS,
|
|
26
|
+
reloadProps: true,
|
|
27
|
+
},
|
|
28
|
+
signingAccountId: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "Signing Account ID",
|
|
31
|
+
description: "The blockchain account ID/address that will be sending this transaction",
|
|
32
|
+
},
|
|
33
|
+
smartContractId: {
|
|
34
|
+
type: "string",
|
|
35
|
+
label: "Smart Contract ID",
|
|
36
|
+
description: "The ID/address of the smart contract to interact with.",
|
|
37
|
+
|
|
38
|
+
},
|
|
39
|
+
functionName: {
|
|
40
|
+
type: "string",
|
|
41
|
+
label: "Function Name",
|
|
42
|
+
description: "The name of the function to call on the smart contract.",
|
|
43
|
+
},
|
|
44
|
+
inputParameters: {
|
|
45
|
+
type: "string[]",
|
|
46
|
+
label: "Input Parameters",
|
|
47
|
+
description: "The input parameters for the smart contract function, in JSON format.",
|
|
48
|
+
optional: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
async additionalProps() {
|
|
52
|
+
const props = {};
|
|
53
|
+
if (this.locationTechnology) {
|
|
54
|
+
props.locationNetwork = {
|
|
55
|
+
type: "string",
|
|
56
|
+
label: "Location Network",
|
|
57
|
+
description: "The blockchain network the transaction will be submitted to.",
|
|
58
|
+
options: NETWORK_OPTIONS[this.locationTechnology],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return props;
|
|
62
|
+
},
|
|
63
|
+
async run({ $ }) {
|
|
64
|
+
const requestBody = {
|
|
65
|
+
location: {
|
|
66
|
+
technology: this.locationTechnology,
|
|
67
|
+
network: this.locationNetwork,
|
|
68
|
+
},
|
|
69
|
+
signingAccountId: this.signingAccountId,
|
|
70
|
+
functionName: this.functionName,
|
|
71
|
+
smartContractId: this.smartContractId,
|
|
72
|
+
inputParameters: parseObject(this.inputParameters), //parse these values using the parseObject function at this shouls turn the JSON string into JSON objects to used in the request body.
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const response = await this.overledger.prepareSmartContractTransaction({
|
|
76
|
+
$,
|
|
77
|
+
environment: this.environment,
|
|
78
|
+
data: requestBody,
|
|
79
|
+
});
|
|
80
|
+
$.export("$summary", "Smart contract transaction prepared successfully");
|
|
81
|
+
return response;
|
|
82
|
+
},
|
|
83
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NETWORK_OPTIONS, TECHNOLOGY_OPTIONS,
|
|
3
|
+
} from "../../common/constants.mjs";
|
|
4
|
+
import { parseObject } from "../../common/utils.mjs";
|
|
5
|
+
import overledger from "../../overledger.app.mjs";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
key: "overledger-read-from-a-smart-contract",
|
|
9
|
+
name: "Read from a smart contract",
|
|
10
|
+
description: "Reads data from a specified smart contract on the Overledger network.",
|
|
11
|
+
version: "0.0.1",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
overledger,
|
|
15
|
+
environment: {
|
|
16
|
+
propDefinition: [
|
|
17
|
+
overledger,
|
|
18
|
+
"environment",
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
locationTechnology: {
|
|
22
|
+
type: "string",
|
|
23
|
+
label: "Location Technology",
|
|
24
|
+
description: "The technology of the blockchain that the transaction will be submitted to",
|
|
25
|
+
options: TECHNOLOGY_OPTIONS,
|
|
26
|
+
reloadProps: true,
|
|
27
|
+
},
|
|
28
|
+
functionName: {
|
|
29
|
+
type: "string",
|
|
30
|
+
label: "Function Name",
|
|
31
|
+
description: "The name of the function to call on the smart contract.",
|
|
32
|
+
},
|
|
33
|
+
inputParameters: {
|
|
34
|
+
type: "string[]",
|
|
35
|
+
label: "Input Parameters",
|
|
36
|
+
description: "The input parameters for the smart contract function, provide both type and value in object format. Example: {\"type\":\"uint256\",\"value\":\"5\"} or {\"type\":\"address\",\"value\":\"0x3....ed8\"}",
|
|
37
|
+
optional: true,
|
|
38
|
+
default: [],
|
|
39
|
+
},
|
|
40
|
+
smartContractId: {
|
|
41
|
+
type: "string",
|
|
42
|
+
label: "Smart Contract ID",
|
|
43
|
+
description: "The ID/address of the smart contract to interact with.",
|
|
44
|
+
},
|
|
45
|
+
outputParameters: {
|
|
46
|
+
type: "string[]",
|
|
47
|
+
label: "Output Parameters",
|
|
48
|
+
description: "Each output parameter expected, provide just the type in object format. Example - 1) function returns one uint256 value: {\"type\": \"uint256\"} or 2) function returns two address values: {\"type\": \"address\"},{\"type\": \"address\"}",
|
|
49
|
+
optional: true,
|
|
50
|
+
default: [],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
async additionalProps() {
|
|
54
|
+
const props = {};
|
|
55
|
+
if (this.locationTechnology) {
|
|
56
|
+
props.locationNetwork = {
|
|
57
|
+
type: "string",
|
|
58
|
+
label: "Location Network",
|
|
59
|
+
description: "The blockchain network the transaction will be submitted to.",
|
|
60
|
+
options: NETWORK_OPTIONS[this.locationTechnology],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return props;
|
|
64
|
+
},
|
|
65
|
+
async run({ $ }) {
|
|
66
|
+
|
|
67
|
+
const requestBody = {
|
|
68
|
+
location: {
|
|
69
|
+
technology: this.locationTechnology,
|
|
70
|
+
network: this.locationNetwork,
|
|
71
|
+
},
|
|
72
|
+
functionName: this.functionName,
|
|
73
|
+
inputParameters: parseObject(this.inputParameters), //parse these values using the parseObject function at this shouls turn the JSON string into JSON objects to used in the request body.
|
|
74
|
+
smartContractId: this.smartContractId,
|
|
75
|
+
outputParameters: parseObject(this.outputParameters),
|
|
76
|
+
};
|
|
77
|
+
// Make the API call to Overledger
|
|
78
|
+
const response = await this.overledger.readFromSmartContract({
|
|
79
|
+
$,
|
|
80
|
+
environment: this.environment,
|
|
81
|
+
data: requestBody,
|
|
82
|
+
});
|
|
83
|
+
$.export("$summary", `Successfully read from contract: ${this.smartContractId}`);
|
|
84
|
+
return response;
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import overledger from "../../overledger.app.mjs";
|
|
2
|
+
import { TECHNOLOGY_OPTIONS, UNIT_OPTIONS } from "../../common/constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "overledger-sign-a-transaction",
|
|
6
|
+
name: "Sign a transaction",
|
|
7
|
+
description: "Sign a transaction using Overledger - Part 2 of [Overledger Pattern](https://developers.quant.network/reference/overledger-pattern). [See documentation](https://developers.quant.network/reference/sandboxsigning)",
|
|
8
|
+
version: "0.0.1",
|
|
9
|
+
type: "action",
|
|
10
|
+
props: {
|
|
11
|
+
overledger,
|
|
12
|
+
environment: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
overledger,
|
|
15
|
+
"environment",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
locationTechnology: {
|
|
19
|
+
type: "string",
|
|
20
|
+
label: "Location Technology",
|
|
21
|
+
description: "The blockchain technology used for this transaction, e.g., ethereum, substrate - required in order to set the dltfee",
|
|
22
|
+
options: TECHNOLOGY_OPTIONS,
|
|
23
|
+
reloadProps: true,
|
|
24
|
+
},
|
|
25
|
+
keyId: {
|
|
26
|
+
type: "string",
|
|
27
|
+
label: "Signing Account ID",
|
|
28
|
+
description: "The ID/address of the blockchain account that will sign the transaction.",
|
|
29
|
+
},
|
|
30
|
+
requestId: {
|
|
31
|
+
type: "string",
|
|
32
|
+
label: "Request ID",
|
|
33
|
+
description: "The Request ID assigned to a preparation request in Overledger. This should be set to the requestId parameter found in the response object of the 'Prepare Transaction' Overledger action.",
|
|
34
|
+
},
|
|
35
|
+
transactionSigningResponderName: {
|
|
36
|
+
type: "string",
|
|
37
|
+
label: "Transaction Signing Responder Name",
|
|
38
|
+
description: "The name of the Transaction Signing Responder you would like to use. The CTA Transaction Signing Responder is the Quant-provided signer for testnet accounts.",
|
|
39
|
+
},
|
|
40
|
+
nativeData: {
|
|
41
|
+
type: "object",
|
|
42
|
+
label: "Native Data",
|
|
43
|
+
description: "An object representing the transaction required to be signed - This should be set to the nativeData object of the 'Prepare Transaction' Overledger action.",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
async run({ $ }) {
|
|
47
|
+
//default values of gatewayFee and dltfee hard coded into params.
|
|
48
|
+
const gatewayFee = {
|
|
49
|
+
amount: "0",
|
|
50
|
+
unit: "QNT",
|
|
51
|
+
};
|
|
52
|
+
// Define DLT Fee and dynamically set the 'unit/symbol' from UNIT_OPTIONS
|
|
53
|
+
const dltFee = {
|
|
54
|
+
amount: "0.000019897764079968",
|
|
55
|
+
unit: UNIT_OPTIONS[this.locationTechnology] || "ETH", // Use default if not found
|
|
56
|
+
};
|
|
57
|
+
// Sign the transaction
|
|
58
|
+
const requestBody = {
|
|
59
|
+
keyId: this.keyId,
|
|
60
|
+
gatewayFee: gatewayFee,
|
|
61
|
+
requestId: this.requestId,
|
|
62
|
+
dltFee: dltFee,
|
|
63
|
+
nativeData: this.nativeData,
|
|
64
|
+
transactionSigningResponderName: this.transactionSigningResponderName,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const response = await this.overledger.signTransaction({
|
|
68
|
+
$,
|
|
69
|
+
environment: this.environment,
|
|
70
|
+
data: requestBody,
|
|
71
|
+
});
|
|
72
|
+
$.export("$summary", "Transaction signed successfully");
|
|
73
|
+
return response;
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const TECHNOLOGY_OPTIONS = [
|
|
2
|
+
{
|
|
3
|
+
label: "Ethereum",
|
|
4
|
+
value: "ethereum",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: "Substrate",
|
|
8
|
+
value: "substrate",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "XRP Ledger",
|
|
12
|
+
value: "xrp ledger",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "Bitcoin",
|
|
16
|
+
value: "bitcoin",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Hyperledger Fabric",
|
|
20
|
+
value: "hyperledger fabric",
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export const NETWORK_OPTIONS = {
|
|
25
|
+
"ethereum": [
|
|
26
|
+
"ethereum sepolia testnet",
|
|
27
|
+
"ethereum goerli testnet",
|
|
28
|
+
"ethereum mainnet",
|
|
29
|
+
"polygon mumbai testnet",
|
|
30
|
+
"polygon mainnet",
|
|
31
|
+
"avalanche fuji testnet",
|
|
32
|
+
"avalanche c-chain mainnet",
|
|
33
|
+
"xdc apothem testnet",
|
|
34
|
+
"xdc network mainnet",
|
|
35
|
+
"Defined on demand",
|
|
36
|
+
],
|
|
37
|
+
"substrate": [
|
|
38
|
+
"polkadot westend",
|
|
39
|
+
"polkadot mainnet",
|
|
40
|
+
],
|
|
41
|
+
"xrp ledger": [
|
|
42
|
+
"testnet",
|
|
43
|
+
"mainnet",
|
|
44
|
+
],
|
|
45
|
+
"bitcoin": [
|
|
46
|
+
"testnet",
|
|
47
|
+
"mainnet",
|
|
48
|
+
],
|
|
49
|
+
"hyperledger fabric": [
|
|
50
|
+
"Sandbox",
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
//Overledger environment to be used - Test or Live
|
|
54
|
+
export const OVERLEDGER_INSTANCE = [
|
|
55
|
+
{
|
|
56
|
+
label: "Sandbox",
|
|
57
|
+
value: "sandbox",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "Overledger",
|
|
61
|
+
value: "overledger",
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
///unit options to allow for the correct selection based on the location network
|
|
65
|
+
export const UNIT_OPTIONS = {
|
|
66
|
+
"ethereum": "ETH", // Ethereum's token symbol is ETH
|
|
67
|
+
"substrate": "DOT", // Polkadot's token symbol is DOT
|
|
68
|
+
"xrp ledger": "XRP", // XRP Ledger's token symbol is XRP
|
|
69
|
+
"bitcoin": "BTC", // Bitcoin's token symbol is BTC
|
|
70
|
+
"hyperledger fabric": "FAB", // Placeholder for Hyperledger Fabric's token symbol
|
|
71
|
+
};
|
package/common/utils.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const parseObject = (obj) => {
|
|
2
|
+
if (Array.isArray(obj)) {
|
|
3
|
+
return obj.map((item) => {
|
|
4
|
+
if (typeof item === "string") {
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(item);
|
|
7
|
+
} catch (e) {
|
|
8
|
+
return item;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return item;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (typeof obj === "string") {
|
|
15
|
+
return JSON.parse(obj);
|
|
16
|
+
}
|
|
17
|
+
return obj;
|
|
18
|
+
};
|
package/overledger.app.mjs
CHANGED
|
@@ -1,11 +1,89 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
import { OVERLEDGER_INSTANCE } from "./common/constants.mjs";
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
type: "app",
|
|
3
6
|
app: "overledger",
|
|
4
|
-
propDefinitions: {
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
smartContractId: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Smart Contract ID",
|
|
11
|
+
description: "The ID of the smart contract to interact with.",
|
|
12
|
+
},
|
|
13
|
+
environment: {
|
|
14
|
+
type: "string",
|
|
15
|
+
label: "Overledger Instance",
|
|
16
|
+
description: "Select the Overledger instance to be used",
|
|
17
|
+
options: OVERLEDGER_INSTANCE,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
5
20
|
methods: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
21
|
+
_headers() {
|
|
22
|
+
return {
|
|
23
|
+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"API-Version": "3.0.0",
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
_getBaseUrl(environment) { //conditional for environment url selection.
|
|
29
|
+
return environment === "sandbox"
|
|
30
|
+
? "https://api.sandbox.overledger.io"
|
|
31
|
+
: "https://api.overledger.io";
|
|
32
|
+
},
|
|
33
|
+
_makeRequest({
|
|
34
|
+
$ = this, environment, path, ...otherOpts
|
|
35
|
+
}) {
|
|
36
|
+
return axios($, {
|
|
37
|
+
...otherOpts,
|
|
38
|
+
url: this._getBaseUrl(environment) + path,
|
|
39
|
+
headers: this._headers(),
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
prepareSmartContractTransaction(opts = {}) {
|
|
43
|
+
return this._makeRequest({
|
|
44
|
+
method: "POST",
|
|
45
|
+
path: "/api/preparations/transactions/smart-contracts/write",
|
|
46
|
+
...opts,
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
readFromSmartContract(opts = {}) {
|
|
50
|
+
return this._makeRequest({
|
|
51
|
+
method: "POST",
|
|
52
|
+
path: "/api/smart-contracts/read",
|
|
53
|
+
...opts,
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
signTransaction(opts = {}) {
|
|
57
|
+
return this._makeRequest({
|
|
58
|
+
method: "POST",
|
|
59
|
+
path: "/api/transaction-signing-sandbox",
|
|
60
|
+
...opts,
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
executeSignedTransaction(opts = {}) {
|
|
64
|
+
return this._makeRequest({
|
|
65
|
+
method: "POST",
|
|
66
|
+
path: "/api/executions/transactions",
|
|
67
|
+
...opts,
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
createHook({
|
|
71
|
+
path, ...opts
|
|
72
|
+
}) {
|
|
73
|
+
return this._makeRequest({
|
|
74
|
+
method: "POST",
|
|
75
|
+
path: `/api/webhooks/${path}`,
|
|
76
|
+
...opts,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
deleteHook({
|
|
80
|
+
path, webhookId, ...opts
|
|
81
|
+
}) {
|
|
82
|
+
return this._makeRequest({
|
|
83
|
+
method: "DELETE",
|
|
84
|
+
path: `/api/webhooks/${path}/${webhookId}`,
|
|
85
|
+
...opts,
|
|
86
|
+
});
|
|
9
87
|
},
|
|
10
88
|
},
|
|
11
|
-
};
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/overledger",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pipedream Overledger Components",
|
|
5
5
|
"main": "overledger.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,5 +11,8 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@pipedream/platform": "^1.5.1"
|
|
14
17
|
}
|
|
15
18
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NETWORK_OPTIONS, TECHNOLOGY_OPTIONS,
|
|
3
|
+
} from "../../common/constants.mjs";
|
|
4
|
+
import overledger from "../../overledger.app.mjs";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
props: {
|
|
8
|
+
overledger,
|
|
9
|
+
environment: {
|
|
10
|
+
propDefinition: [
|
|
11
|
+
overledger,
|
|
12
|
+
"environment",
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
db: "$.service.db",
|
|
16
|
+
http: {
|
|
17
|
+
type: "$.interface.http",
|
|
18
|
+
customResponse: true,
|
|
19
|
+
},
|
|
20
|
+
locationTechnology: {
|
|
21
|
+
type: "string",
|
|
22
|
+
label: "Location Technology",
|
|
23
|
+
description: "The technology of the blockchain that the transaction will be submitted to",
|
|
24
|
+
options: TECHNOLOGY_OPTIONS,
|
|
25
|
+
reloadProps: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
async additionalProps() {
|
|
29
|
+
const props = {};
|
|
30
|
+
if (this.locationTechnology) {
|
|
31
|
+
props.locationNetwork = {
|
|
32
|
+
type: "string",
|
|
33
|
+
label: "Location Network",
|
|
34
|
+
description: "The blockchain network the transaction will be submitted to.",
|
|
35
|
+
options: NETWORK_OPTIONS[this.locationTechnology],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return props;
|
|
39
|
+
},
|
|
40
|
+
hooks: {
|
|
41
|
+
async activate() {
|
|
42
|
+
const response = await this.overledger.createHook({
|
|
43
|
+
path: this.getPath(),
|
|
44
|
+
environment: this.environment,
|
|
45
|
+
data: {
|
|
46
|
+
location: {
|
|
47
|
+
technology: this.locationTechnology,
|
|
48
|
+
network: this.locationNetwork,
|
|
49
|
+
},
|
|
50
|
+
callbackUrl: this.http.endpoint,
|
|
51
|
+
...this.additionalData(),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
this.db.set("webhookId", response.webhookId);
|
|
55
|
+
},
|
|
56
|
+
async deactivate() {
|
|
57
|
+
const webhookId = this.db.get("webhookId");
|
|
58
|
+
await this.overledger.deleteHook({
|
|
59
|
+
path: this.getPath(),
|
|
60
|
+
webhookId,
|
|
61
|
+
environment: this.environment,
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
async run(event) {
|
|
66
|
+
const { body } = event;
|
|
67
|
+
|
|
68
|
+
this.$emit(body, {
|
|
69
|
+
id: body.transactionId || body?.smartContractEventUpdateDetails?.nativeData?.transactionHash,
|
|
70
|
+
summary: this.getSummary(body),
|
|
71
|
+
ts: Date.now(),
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "overledger-new-contract-event-instant",
|
|
7
|
+
name: "New Smart Contract Event (Instant)",
|
|
8
|
+
description: "Emit new event when a smart contract releases a new event.",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
smartContractId: {
|
|
15
|
+
propDefinition: [
|
|
16
|
+
common.props.overledger,
|
|
17
|
+
"smartContractId",
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
methods: {
|
|
22
|
+
getPath() {
|
|
23
|
+
return "smart-contract-events";
|
|
24
|
+
},
|
|
25
|
+
additionalData() {
|
|
26
|
+
return {
|
|
27
|
+
smartContractId: this.smartContractId,
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
getSummary(body) {
|
|
31
|
+
return `New contract event with transaction Hash: ${body?.smartContractEventUpdateDetails?.nativeData?.transactionHash}`;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
sampleEmit,
|
|
35
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "smartContractEvent",
|
|
3
|
+
"webhookId": "6c964253-4b10-43a5-a812-9b30e92275a3",
|
|
4
|
+
"location": {
|
|
5
|
+
"technology": "ethereum",
|
|
6
|
+
"network": "polygon mumbai testnet"
|
|
7
|
+
},
|
|
8
|
+
"smartContractEventUpdateDetails": {
|
|
9
|
+
"smartContractId": "0x8590d37d55049de2555f0f9541325e7fe6b19b17",
|
|
10
|
+
"nativeData": {
|
|
11
|
+
"removed": false,
|
|
12
|
+
"logIndex": 0,
|
|
13
|
+
"transactionIndex": 0,
|
|
14
|
+
"transactionHash": "0xde2bbf9704d726ff395eb78217e9acb226b0ecb0b609021cccd7e67d99763db2",
|
|
15
|
+
"blockHash": "0x6d1a13d15fd0a90f361d3e368830bbe45c628382c4533d10f1a23ae699c781cc",
|
|
16
|
+
"blockNumber": "0x28b2471",
|
|
17
|
+
"address": "0x8590d37d55049de2555f0f9541325e7fe6b19b17",
|
|
18
|
+
"data": "0x0000000000000000000000001789d90438333751fdcca0d03d8952168b99ef02",
|
|
19
|
+
"topics": [
|
|
20
|
+
"0x2d1801d4e6df986759c8582affebc974bcf0cacfd5d2ab120eb776efa53dffa2"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"type": "account",
|
|
3
|
+
"webhookId": "20f6ce08-04b4-4ce4-94eb-e2304a0737af",
|
|
4
|
+
"accountId": "0x282f70d5af34aedaac479b12a08e189bbee83066",
|
|
5
|
+
"location": {
|
|
6
|
+
"technology": "ethereum",
|
|
7
|
+
"network": "polygon mumbai testnet"
|
|
8
|
+
},
|
|
9
|
+
"transactionId": "0xd65c16e476a5ad5fa89ffe14512bd7984e575a4370ac86ccfb88202da20f9262"
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import common from "../common/base.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...common,
|
|
6
|
+
key: "overledger-watch-new-account-event-instant",
|
|
7
|
+
name: "New Account Event (Instant)",
|
|
8
|
+
description: "Emit new event for transactions to/from a specific account.",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
type: "source",
|
|
11
|
+
dedupe: "unique",
|
|
12
|
+
props: {
|
|
13
|
+
...common.props,
|
|
14
|
+
accountId: {
|
|
15
|
+
type: "string",
|
|
16
|
+
label: "Account Id",
|
|
17
|
+
description: "The blockchain account that will be monitored for transaction updates.",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
getPath() {
|
|
22
|
+
return "accounts";
|
|
23
|
+
},
|
|
24
|
+
additionalData() {
|
|
25
|
+
return {
|
|
26
|
+
accountId: this.accountId,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
getSummary(body) {
|
|
30
|
+
return `New account event with transaction Id: ${body.transactionId}`;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
sampleEmit,
|
|
34
|
+
};
|