Skip to content

Commit

Permalink
fix bug mops and dfx json
Browse files Browse the repository at this point in the history
  • Loading branch information
wirapratamaz committed May 28, 2024
1 parent 9db9789 commit 3acdbaa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 59 deletions.
4 changes: 2 additions & 2 deletions dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
}
},
"defaults": {
"replica": {
"subnet_type": "system"
"build": {
"packtool": "mops sources"
}
},
"version": 1
Expand Down
3 changes: 1 addition & 2 deletions src/Utils.mo
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ import Int64 "mo:base/Int64";
import Error "mo:base/Error";
import Map "mo:map/Map";
import Sha256 "mo:sha2/Sha256";
import HttpTypes "http/http.types";
import HttpTypes "http/http";
import Hex "Hex";
import Types "Types";
import Random "mo:base/Random";
import { JSON; Candid; } "mo:serde";


module {
public func now() : Nat64 {
let now = Nat64.fromNat(Int.abs(Time.now()));
Expand Down
2 changes: 1 addition & 1 deletion src/currency/FXFactory.mo
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Map "mo:map/Map";
import Types "../Types";
import Utils "../Utils";
import HttpTypes "../http/http";
import { Json; Candid; CBOR; URLEncoded } "mo:serde";
import { Candid; CBOR; JSON; URLEncoded } "mo:serde";
import Helper "../helper/helper";

// Build general class for exchange rates
Expand Down
54 changes: 0 additions & 54 deletions src/helper/helper.mo
Original file line number Diff line number Diff line change
Expand Up @@ -455,60 +455,6 @@ module Web3Helper {
};

/* ----------------- TRANSACTIONS ------------------- */
public func getTransactionReceipt(hash : Text, chain : Types.TokenChain, token : Types.TokenCurrency) : async ?Types.TransactionReceipt {

// --data '
// {
// "id": 1,
// "jsonrpc": "2.0",
// "method": "eth_getTransactionReceipt",
// "params": [
// "0x..."
// ]
// }
//DATA, 32 Bytes - hash of a transaction
// params: [
// '0x...'
// ]

assert (pre_init() == true);
assert (Text.size(hash) == 66);

let p : EthJsonRpcParam = {
data = ?hash;
to = null;
};
let request : EthJsonRpcRequest = {
id = 0;
jsonrpc = "2.0";
method = "eth_getTransactionReceipt";
params = [p];
};
let response = await callEVM(request);

// let stripped = safeTransformEvm(response.result);
// let #ok(h) = Hex.decode(stripped) else return 0;
// var safeValue = AU.toNat256(h);
// return safeValue;

Debug.print("getTransactionReceipt ");
Debug.print("result " # debug_show (response));

let r : Types.TransactionReceipt = {
status = false;
transactionHash = "";
transactionIndex = 0;
blockHash = "";
blockNumber = 0;
contractAddress = "";
cumulativeGasUsed = 0;
gasUsed = 0;
chain = chain;
token_type = token;
};

return ?r;
};

private func decode_abi(b64abi : Text) : ?Text {
let blob = Text.encodeUtf8(b64abi);
Expand Down

0 comments on commit 3acdbaa

Please sign in to comment.