mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-27 23:01:33 +00:00
Implement debug.stringify service (#125)
This commit is contained in:
@ -18,6 +18,7 @@ import { CallServiceResult } from '@fluencelabs/avm-runner-interface';
|
||||
import { encode, decode } from 'bs58';
|
||||
import { sha256 } from 'multiformats/hashes/sha2';
|
||||
import { ResultCodes } from '../commonTypes';
|
||||
import { jsonify } from '../utils'
|
||||
import Buffer from '../Buffer';
|
||||
|
||||
const success = (result: any): CallServiceResult => {
|
||||
@ -128,6 +129,22 @@ export const builtInServices = {
|
||||
},
|
||||
},
|
||||
|
||||
debug: {
|
||||
stringify: (req) => {
|
||||
let out;
|
||||
|
||||
if (req.args.length === 0) {
|
||||
out = '<empty argument list>';
|
||||
} else if (req.args.length === 1) {
|
||||
out = req.args[0];
|
||||
} else {
|
||||
out = req.args;
|
||||
}
|
||||
|
||||
return success(jsonify(out));
|
||||
},
|
||||
},
|
||||
|
||||
peer: {
|
||||
timeout: (req) => {
|
||||
if (req.args.length !== 2) {
|
||||
|
Reference in New Issue
Block a user