Skip to content

Commit 2b4a1a8

Browse files
committed
modified readfromsmart contract transaction, prepare-sign-execute transaction actions
1 parent 4ff3794 commit 2b4a1a8

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

components/overledger/actions/prepare-smart-contract-transaction/prepare-smart-contract-transaction.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
NETWORK_OPTIONS, TECHNOLOGY_OPTIONS
2+
NETWORK_OPTIONS, TECHNOLOGY_OPTIONS,
33
} from "../../common/constants.mjs";
44
import { parseObject } from "../../common/utils.mjs";
55
import overledger from "../../overledger.app.mjs";
@@ -64,7 +64,7 @@ export default {
6464
functionName: this.functionName,
6565
smartContractId: this.smartContractId,
6666
inputParameters: parseObject(this.inputParameters),
67-
}
67+
};
6868

6969
const response = await this.overledger.prepareSmartContractTransaction({
7070
$,

components/overledger/actions/read-from-a-smart-contract/read-from-smart-contract.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export default {
6666
outputParameters: parseObject(this.outputParameters),
6767
};
6868
// Make the API call to Overledger
69-
const response = await this.overledger.readFromSmartContract({
70-
$,
71-
data: requestBody,
72-
});
73-
$.export("$summary", `Successfully read from contract: ${this.smartContractId}`);
74-
return response;
69+
const response = await this.overledger.readFromSmartContract({
70+
$,
71+
data: requestBody,
72+
});
73+
$.export("$summary", `Successfully read from contract: ${this.smartContractId}`);
74+
return response;
7575
},
7676
};

components/overledger/actions/sign-a-transaction/sign-a-transaction.mjs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,31 @@ export default {
2626
},
2727
nativeData: {
2828
type: "object",
29-
label: "the transaction data required to be signed",
29+
label: "Native Data",
3030
description: "A JSON object representing the transaction required to be signed.",
31-
},
32-
locationTechnology: {
33-
type: "string",
34-
label: "Location Technology",
35-
description: "The blockchain technology used for this transaction, e.g., ethereum, substrate.",
3631
optional: true,
3732
// Reference the output of the previous step
38-
default: ({ steps }) => steps.prepare_smart_contract_transaction?.locationTechnology,
33+
default: ({ steps }) => steps.prepare_smart_contract_transaction?.nativeData,
3934
},
4035
},
36+
locationTechnology: {
37+
type: "string",
38+
label: "Location Technology",
39+
description: "The blockchain technology used for this transaction, e.g., ethereum, substrate.",
40+
optional: true,
41+
// Reference the output of the previous step
42+
default: ({ steps }) => steps.prepare_smart_contract_transaction?.locationTechnology,
43+
},
4144
async run({ $ }) {
45+
//default values of gatewayFee and dltfee hard coded into params.
4246
const gatewayFee = {
43-
amount: "100",
47+
amount: "0",
4448
unit: "QNT",
4549
};
46-
// Define DLT Fee and dynamically set the 'unit' from UNIT_OPTIONS
50+
// Define DLT Fee and dynamically set the 'unit/symbol' from UNIT_OPTIONS
4751
const dltFee = {
4852
amount: "0.000019897764079968",
49-
unit: UNIT_OPTIONS[this.locationTechnology] || "ETH" // Use default if not found
53+
unit: UNIT_OPTIONS[this.locationTechnology] || "ETH", // Use default if not found
5054
};
5155
// Sign the transaction
5256
const requestBody = {
@@ -56,7 +60,7 @@ export default {
5660
dltFee: dltFee,
5761
nativeData: this.nativeData,
5862
transactionSigningResponderName: this.transactionSigningResponderName,
59-
}
63+
};
6064

6165
const response = await this.overledger.signTransaction({
6266
$,

components/overledger/common/constants.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export const UNIT_OPTIONS = {
5757
"xrp ledger": "XRP", // XRP Ledger's token symbol is XRP
5858
"bitcoin": "BTC", // Bitcoin's token symbol is BTC
5959
"hyperledger fabric": "FAB", // Placeholder for Hyperledger Fabric's token symbol
60-
};
60+
};

components/overledger/overledger.app.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default {
1414
_baseUrl() {
1515
return "https://api.overledger.io";
1616
},
17-
_sanboxBaseUrl(){
17+
//Sanbox base URL
18+
_sanboxBaseUrl() {
1819
return "https://api.sandbox.overledger.io";
1920
},
2021
_headers() {

0 commit comments

Comments
 (0)