@witnet/sdk 1.0.0-beta.5 → 1.0.3

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.
Files changed (66) hide show
  1. package/dist/package.json +3 -1
  2. package/dist/src/bin/helpers.d.ts +1 -0
  3. package/dist/src/bin/helpers.d.ts.map +1 -1
  4. package/dist/src/bin/helpers.js +12 -2
  5. package/dist/src/lib/crypto/interfaces.d.ts +7 -0
  6. package/dist/src/lib/crypto/interfaces.d.ts.map +1 -1
  7. package/dist/src/lib/crypto/interfaces.js +1 -1
  8. package/dist/src/lib/crypto/payloads/DataRequestPayload.d.ts +2 -2
  9. package/dist/src/lib/crypto/payloads/DataRequestPayload.d.ts.map +1 -1
  10. package/dist/src/lib/crypto/payloads/DataRequestPayload.js +8 -8
  11. package/dist/src/lib/crypto/payloads.d.ts.map +1 -1
  12. package/dist/src/lib/crypto/payloads.js +1 -12
  13. package/dist/src/lib/crypto/signer.d.ts +8 -1
  14. package/dist/src/lib/crypto/signer.d.ts.map +1 -1
  15. package/dist/src/lib/crypto/signer.js +23 -2
  16. package/dist/src/lib/crypto/transmitters/DataRequests.d.ts +0 -1
  17. package/dist/src/lib/crypto/transmitters/DataRequests.d.ts.map +1 -1
  18. package/dist/src/lib/crypto/transmitters/DataRequests.js +1 -2
  19. package/dist/src/lib/crypto/types.d.ts +2 -2
  20. package/dist/src/lib/crypto/types.d.ts.map +1 -1
  21. package/dist/src/lib/crypto/types.js +4 -5
  22. package/dist/src/lib/crypto/utils.d.ts +2 -1
  23. package/dist/src/lib/crypto/utils.d.ts.map +1 -1
  24. package/dist/src/lib/crypto/utils.js +6 -1
  25. package/dist/src/lib/crypto/wallet.d.ts.map +1 -1
  26. package/dist/src/lib/crypto/wallet.js +1 -4
  27. package/dist/src/lib/radon/ccdr/wit.d.ts +11 -0
  28. package/dist/src/lib/radon/ccdr/wit.d.ts.map +1 -1
  29. package/dist/src/lib/radon/ccdr/wit.js +17 -2
  30. package/dist/src/lib/radon/index.d.ts +1 -1
  31. package/dist/src/lib/radon/index.d.ts.map +1 -1
  32. package/dist/src/lib/radon/index.js +9 -3
  33. package/dist/src/lib/rpc/provider.d.ts +5 -3
  34. package/dist/src/lib/rpc/provider.d.ts.map +1 -1
  35. package/dist/src/lib/rpc/provider.js +14 -3
  36. package/dist/src/lib/rpc/reporter.d.ts +2 -3
  37. package/dist/src/lib/rpc/reporter.d.ts.map +1 -1
  38. package/dist/src/lib/rpc/reporter.js +1 -4
  39. package/dist/src/lib/rpc/types.d.ts +49 -24
  40. package/dist/src/lib/rpc/types.d.ts.map +1 -1
  41. package/dist/src/lib/rpc/types.js +3 -1
  42. package/dist/src/lib/types.d.ts +1 -1
  43. package/dist/src/lib/types.d.ts.map +1 -1
  44. package/dist/src/lib/types.js +1 -1
  45. package/dist/src/lib/utils.d.ts +3 -2
  46. package/dist/src/lib/utils.d.ts.map +1 -1
  47. package/dist/src/lib/utils.js +16 -9
  48. package/dist/witnet/assets/index.d.ts +6 -6
  49. package/dist/witnet/assets/modals/index.d.ts +10 -11
  50. package/dist/witnet/assets/modals/index.js +2 -12
  51. package/dist/witnet/assets/modals/web3/ipfs.d.ts +5 -0
  52. package/dist/witnet/assets/modals/web3/ipfs.d.ts.map +1 -0
  53. package/dist/witnet/assets/modals/web3/ipfs.js +16 -0
  54. package/dist/witnet/assets/modals/web3/wit.d.ts +1 -1
  55. package/dist/witnet/assets/modals/web3/wit.js +6 -9
  56. package/dist/witnet/assets/requests.js +1 -1
  57. package/package.json +3 -1
  58. package/src/bin/cli/inspect.js +49 -3
  59. package/src/bin/cli/network.js +9 -7
  60. package/src/bin/cli/radon.js +3 -3
  61. package/src/bin/cli/wallet.js +164 -47
  62. package/src/bin/helpers.js +13 -2
  63. package/witnet/assets/modals/index.js +1 -17
  64. package/witnet/assets/modals/web3/ipfs.js +19 -0
  65. package/witnet/assets/modals/web3/wit.js +4 -6
  66. package/witnet/assets/requests.js +1 -0
@@ -63,6 +63,10 @@ module.exports = {
63
63
  hint: "List wallet's HD-accounts treasuring staked, locked or unlocked Wits.",
64
64
  params: ["[WIT_ADDRESSES ...]"],
65
65
  options: {
66
+ ethereum: {
67
+ hint: "Generate account ownership proofs verifiable in Ethereum networks.",
68
+ param: "EVM_ADDRESS"
69
+ },
66
70
  limit: {
67
71
  hint: "Max number of HD-accounts to derive.",
68
72
  param: "LIMIT",
@@ -97,7 +101,7 @@ module.exports = {
97
101
  },
98
102
  },
99
103
  },
100
- decipher: {
104
+ decipherMasterKey: {
101
105
  hint: "Decipher some master key as exported from myWitWallet.",
102
106
  },
103
107
  delegatees: {
@@ -125,6 +129,30 @@ module.exports = {
125
129
  provider: {
126
130
  hint: "Show the underlying Wit/Oracle RPC provider being used.",
127
131
  },
132
+ signMessage: {
133
+ hint: "Prove ownership of a wallet address by signing some given message.",
134
+ param: "TEXT",
135
+ options: {
136
+ signer: {
137
+ hint: "Wallet's signer address other than wallet's default.",
138
+ param: "WALLET_ADDRESS",
139
+ },
140
+ },
141
+ },
142
+ verifyMessage: {
143
+ hint: "Verify authenticity of some given message and signature.",
144
+ param: "TEXT",
145
+ options: {
146
+ publicKey: {
147
+ hint: "Hexified public key of the alleged signer of the message.",
148
+ param: "<HEX_STRING>",
149
+ },
150
+ signature: {
151
+ hint: "Hexified signature produced with the signer's private key.",
152
+ param: "<HEX_STRING>",
153
+ },
154
+ },
155
+ },
128
156
  stake: {
129
157
  hint: "Stake specified amount of Wits by using some given authorization code.",
130
158
  params: "AUTH_CODE",
@@ -148,6 +176,10 @@ module.exports = {
148
176
  hint: "Recipient address.",
149
177
  param: "WIT_ADDRESS",
150
178
  },
179
+ metadata: {
180
+ hint: "Optional 20-byte metadata info.",
181
+ param: "HEX_STRING"
182
+ },
151
183
  value: {
152
184
  hint: "Amount in Wits to be transfered (e.g. `0.5` Wits).",
153
185
  param: "WITS | `all`",
@@ -163,6 +195,10 @@ module.exports = {
163
195
  param: "WALLET_ADDRESS",
164
196
  },
165
197
  join: { hint: "Join selected UTXOs together into a single UTXO (requires --value)." },
198
+ limit: {
199
+ hint: "Max number of HD-accounts to derive.",
200
+ param: "LIMIT",
201
+ },
166
202
  splits: {
167
203
  hint: "Number of UTXOs to split the target balance into (max: 50; requires --value).",
168
204
  param: "NUMBER",
@@ -195,15 +231,70 @@ module.exports = {
195
231
  },
196
232
  },
197
233
  subcommands: {
198
- accounts, coinbase, decipher, delegatees: validators, notarize: resolve, provider, stake, transfer, withdraw: unstake, utxos,
234
+ accounts, coinbase, delegatees: validators,
235
+ notarize: resolve, stake, transfer, withdraw: unstake, utxos,
236
+ decipherMasterKey: decipher, provider,
237
+ signMessage, verifyMessage,
199
238
  },
200
239
  }
201
240
 
202
241
  /// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
203
242
  /// CLI SUBMODULE COMMANDS ============================================================================================
204
243
 
244
+ async function signMessage (options = {}, [...words]) {
245
+ const wallet = await _loadWallet({
246
+ ...options,
247
+ limit: 1,
248
+ "no-funds": true,
249
+ })
250
+ if (!words.length) {
251
+ throw Error(`some message must be entered.`)
252
+ }
253
+ const text = words.join(" ")
254
+ let ledger
255
+ if (options?.signer) {
256
+ ledger = options.signer === wallet.coinbase.pkh ? wallet.coinbase : wallet.getAccount(options.signer)
257
+ } else {
258
+ ledger = wallet
259
+ }
260
+ if (!ledger) {
261
+ throw Error(`no private key available for signer address ${options?.signer}`)
262
+ }
263
+ console.info(ledger.getSigner().signMessage(text))
264
+ }
265
+
266
+ async function verifyMessage (options = {}, [...words]) {
267
+ if (!words.length) {
268
+ throw Error(`some text must be entered.`)
269
+ }
270
+ const text = words.join(" ")
271
+ const digest = utils.digestMessage(text)
272
+ let { publicKey, signature } = options
273
+ if (!publicKey) {
274
+ throw Error(`--publicKey must be specified.`)
275
+ } else if (!signature) {
276
+ throw Error(`--signature must be specified`)
277
+ }
278
+ if (publicKey.startsWith("0x")) publicKey = publicKey.slice(2);
279
+ if (signature.startsWith("0x")) signature = signature.slice(2);
280
+ console.info(`Message: "${text}"`)
281
+ console.info(`Digest: ${utils.toHexString(digest)}`)
282
+ console.info(`Public key: ${publicKey}`)
283
+ console.info(`Signature: ${signature}`)
284
+ console.info("-".repeat(120))
285
+ if (utils.ecdsaVerify(digest, publicKey, signature.slice(2))) {
286
+ console.info(
287
+ `^ Signed by ${
288
+ Witnet.PublicKey.fromUint8Array(utils.fromHexString(publicKey)).hash().toBech32("mainnet")
289
+ }.\n^ Message is authentic.`
290
+ );
291
+ } else {
292
+ console.error(`^ Invalid signature.`)
293
+ }
294
+ }
295
+
205
296
  async function accounts (options = {}, args = []) {
206
- const { verbose } = options
297
+ const { ethereum, verbose } = options
207
298
 
208
299
  let wallet
209
300
  if (args.length === 0) {
@@ -256,6 +347,9 @@ async function accounts (options = {}, args = []) {
256
347
  balance.unlocked > 0 ? colors.mmagenta(account.pkh) : colors.magenta(account.pkh),
257
348
  utxos.length,
258
349
  balance,
350
+ ...(ethereum ? [
351
+ account.getSigner().authorizeEvmAddress(ethereum),
352
+ ] : [])
259
353
  ]
260
354
  }),
261
355
  )
@@ -263,45 +357,53 @@ async function accounts (options = {}, args = []) {
263
357
 
264
358
  let unlocked = 0n
265
359
  helpers.traceTable(
266
- records.map(([index, pkh, count, balance]) => {
360
+ records.map(([index, pkh, count, balance, signature]) => {
267
361
  unlocked += balance.unlocked
268
362
  return [
269
- index,
270
- pkh,
271
- count,
272
- ...(verbose
273
- ? [
274
- Witnet.Coins.fromNanowits(balance.locked).wits.toFixed(2),
275
- Witnet.Coins.fromNanowits(balance.staked).wits.toFixed(2),
276
- Witnet.Coins.fromNanowits(balance.unlocked).wits.toFixed(2),
277
- utils.totalCoins(balance).wits.toFixed(2),
278
- ]
279
- : [
280
- Witnet.Coins.fromNanowits(balance.unlocked).wits.toFixed(2),
281
- ]
363
+ index, pkh,
364
+ ...(ethereum ? [ signature ] : (
365
+ verbose
366
+ ? [
367
+ count,
368
+ Witnet.Coins.fromNanowits(balance.locked).wits.toFixed(2),
369
+ Witnet.Coins.fromNanowits(balance.staked).wits.toFixed(2),
370
+ Witnet.Coins.fromNanowits(balance.unlocked).wits.toFixed(2),
371
+ utils.totalCoins(balance).wits.toFixed(2),
372
+ ]
373
+ : [
374
+ count,
375
+ Witnet.Coins.fromNanowits(balance.unlocked).wits.toFixed(2),
376
+ ]
377
+ )
282
378
  ),
283
379
  ]
284
380
  }), {
285
381
  headlines: [
286
- "INDEX", `:WALLET ${wallet.network.toUpperCase()} ACCOUNTS`,
287
- "# UTXOs",
288
- ...(verbose
289
- ? ["Locked ($WIT)", "Staked ($WIT)", "Available ($WIT)", "BALANCE ($WIT)"]
290
- : ["Available ($WIT)"]
291
- ),
382
+ "INDEX", `:WITNET WALLET ${wallet.network.toUpperCase()} ACCOUNTS`,
383
+ ...(ethereum ? [`ETHEREUM ${wallet.network.toUpperCase()} WRAPPING AUTHORIZATION CODE [${ethereum}]`] : (
384
+ verbose
385
+ ? ["# UTXOS", "Locked ($WIT)", "Staked ($WIT)", "Available ($WIT)", "BALANCE ($WIT)"]
386
+ : ["# UTXOS", "Available ($WIT)"]
387
+ )
388
+ )
292
389
  ],
293
390
  humanizers: [
294
391
  helpers.commas,,
295
- helpers.commas, helpers.commas, helpers.commas, helpers.commas, helpers.commas,
392
+ ...(ethereum
393
+ ? [,]
394
+ : [helpers.commas, helpers.commas, helpers.commas, helpers.commas, helpers.commas]
395
+ ),
296
396
  ],
297
397
  colors: [
298
398
  ,,
299
- ...(verbose
300
- ? [colors.white, colors.gray, colors.yellow, colors.myellow, colors.lyellow]
301
- : [colors.white, colors.myellow]
399
+ ...(ethereum ? [colors.mblue, colors.gray] : (
400
+ verbose
401
+ ? [colors.white, colors.gray, colors.yellow, colors.myellow, colors.lyellow]
402
+ : [colors.white, colors.myellow]
403
+ )
302
404
  ),
303
405
  ],
304
- maxColumnWidth: 48,
406
+ maxColumnWidth: 132,
305
407
  }
306
408
  )
307
409
  console.info(`^ Available balance: ${colors.lyellow(whole_wits(unlocked, 2))}`)
@@ -516,15 +618,26 @@ async function transfer (options = {}) {
516
618
  available = balance.unlocked
517
619
  }
518
620
 
621
+ // validate metadata info, if specified
622
+ let metadata
623
+ if (options?.metadata) {
624
+ if (!utils.isHexStringOfLength(options.metadata, 20)) {
625
+ throw Error(`--metadata must be a 20-byte hex string`)
626
+ }
627
+ metadata = Witnet.PublicKeyHash.fromHexString(options.metadata).toBech32(wallet.network)
628
+ }
629
+
519
630
  // validate recipient address
520
631
  if (!options?.into) {
521
632
  throw Error("--into address must be specified")
522
633
  }
523
634
  const into = Witnet.PublicKeyHash.fromBech32(options?.into).toBech32(wallet.network)
524
-
635
+
525
636
  // determine transfer params
526
637
  const params = await _loadTransactionParams({ ...options })
527
- const coins = params?.value === "all" ? Witnet.Coins.fromPedros(available - params.fees.pedros) : Witnet.Coins.fromWits(params?.value)
638
+ const coins = params?.value === "all"
639
+ ? Witnet.Coins.fromPedros(BigInt(available - params.fees.pedros - BigInt(options?.metadata ? 1: 0)))
640
+ : Witnet.Coins.fromWits(params?.value)
528
641
  if (available < coins.pedros) {
529
642
  throw Error(`Insufficient funds ${options?.from ? `on address ${options.from}.` : "on wallet."}`)
530
643
  } else if (params?.fees && coins.pedros <= params.fees.pedros) {
@@ -532,12 +645,15 @@ async function transfer (options = {}) {
532
645
  }
533
646
 
534
647
  // transfer value
648
+ const recipients = options?.metadata
649
+ ? [[into, coins], [metadata, Witnet.Coins.fromPedros(1n)]]
650
+ : [[into, coins]]
535
651
  await helpers.traceTransaction(
536
652
  Witnet.ValueTransfers.from(ledger), {
537
653
  headline: "VALUE TRANSFER TRANSACTION",
538
654
  color: colors.bblue,
539
655
  ...params,
540
- recipients: [[into, coins]],
656
+ recipients,
541
657
  }
542
658
  )
543
659
  }
@@ -691,9 +807,10 @@ async function utxos (options = {}) {
691
807
  }
692
808
  const utxos = await ledger.selectUtxos({ value })
693
809
  const covered = utxos.map(utxo => BigInt(utxo.value))?.reduce((prev, curr) => prev + curr, 0n) || 0n
694
- if (value && covered < value.pedros) {
695
- throw Error(`Insufficient unlocked UTXOs in ${options?.from ? `wallet account ${ledger.pkh}` : "wallet"}`)
696
- }
810
+ // if (value && covered < value.pedros) {
811
+ // console.log(value, covered)
812
+ // throw Error(`Insufficient unlocked UTXOs in ${options?.from ? `wallet account ${ledger.pkh}` : "wallet"}`)
813
+ // }
697
814
 
698
815
  // only if at least one utxo is selected, proceed with report and other operations, if any
699
816
  if (utxos.length > 0) {
@@ -705,7 +822,7 @@ async function utxos (options = {}) {
705
822
  utxo?.internal ? colors.green(utxo.output_pointer) : colors.mgreen(utxo.output_pointer),
706
823
  utxo.value,
707
824
  ]), {
708
- headlines: ["INDEX", `WALLET ${wallet.network.toUpperCase()} ADDRESSES`, ":Unlocked UTXO pointers", "UTXO value ($pedros)"],
825
+ headlines: ["INDEX", `WITNET WALLET ${wallet.network.toUpperCase()} ADDRESSES`, ":Unlocked UTXO pointers", "UTXO value ($pedros)"],
709
826
  humanizers: [helpers.commas,,, helpers.commas],
710
827
  colors: [,,, colors.myellow],
711
828
  }
@@ -722,7 +839,7 @@ async function utxos (options = {}) {
722
839
  value,
723
840
  ]]
724
841
  await helpers.traceTransaction(valueTransfer, {
725
- headline: `JOINING UTXOs: ${utxos.length} -> ${coins.pedros < covered ? 2 : 1}`,
842
+ headline: `JOINING UTXOs: ${utxos.length} -> ${value.pedros < covered ? 2 : 1}`,
726
843
  ...params,
727
844
  await: params?.await || options?.splits !== undefined,
728
845
  recipients,
@@ -734,11 +851,11 @@ async function utxos (options = {}) {
734
851
  if (splits > 50) {
735
852
  throw Error("Not possible to split into more than 50 UTXOs")
736
853
  }
737
- value = Witnet.Coins.fromPedros(BigInt(Math.floor(value.pedros / splits)))
738
- recipients.push(...Array(splits).fill([into, coins]))
854
+ value = Witnet.Coins.fromPedros(BigInt(Math.floor(Number(value.pedros) / splits)))
855
+ recipients.push(...Array(splits).fill([into, value]))
739
856
  await helpers.traceTransaction(
740
857
  valueTransfer, {
741
- headline: `SPLITTING UTXOs: ${utxos.length} -> ${coins.pedros * splits < covered ? splits + 1 : splits}`,
858
+ headline: `SPLITTING UTXOs: ${utxos.length} -> ${Number(value.pedros) * splits < covered ? splits + 1 : splits}`,
742
859
  ...params,
743
860
  recipients,
744
861
  reload: options?.join,
@@ -780,7 +897,7 @@ async function validators (options = {}) {
780
897
  }), {
781
898
  headlines: [
782
899
  // "INDEX",
783
- coinbase ? "WALLET COINBASE" : `WALLET ${wallet.network.toUpperCase()} ACCOUNTS`,
900
+ coinbase ? "WITNET WALLET COINBASE" : `WITNET WALLET ${wallet.network.toUpperCase()} ACCOUNTS`,
784
901
  "STAKE DELEGATEES",
785
902
  ...(verbose
786
903
  ? ["Nonce", "LW_Epoch", "LM_Epoch"]
@@ -814,16 +931,16 @@ async function validators (options = {}) {
814
931
 
815
932
  async function _loadRadonRequest (options = {}) {
816
933
  const args = options?.args || []
817
- // TODO:
934
+ if (options?.pattern && typeof options.pattern === 'string' && utils.isHexString(options.pattern)) {
818
935
  // if (options?.pattern && typeof options.pattern === 'string' && utils.isHexString(options.pattern)) {
819
936
  // if (utils.isHexStringOfLength(options.pattern, 32)) {
820
937
  // throw `Searching RADON_BYTECODE by RAD_HASH not yet supported.`
821
- // } else try {
822
- // return Witnet.RadonRequest.fromHexString(pattern)
823
- // } catch {
824
- // throw `Invalid RADON_BYTECODE.`
825
- // }
826
- // }
938
+ try {
939
+ return Witnet.Radon.RadonRequest.fromBytecode(options.pattern)
940
+ } catch (e) {
941
+ throw Error(`Invalid RADON_BYTECODE: ${e}`)
942
+ }
943
+ }
827
944
 
828
945
  // load Radon assets from environment
829
946
  let assets = utils.searchRadonAssets(
@@ -347,7 +347,7 @@ function showVersion () {
347
347
 
348
348
  function getWildcardsCountFromString (str) {
349
349
  let maxArgsIndex = 0
350
- if (str) {
350
+ if (str && typeof str === 'string') {
351
351
  let match
352
352
  const regexp = /\\\d\\/g
353
353
  while ((match = regexp.exec(str)) !== null) {
@@ -433,6 +433,16 @@ function toUpperCamelCase (str) {
433
433
  }).replace(/\s+/g, "")
434
434
  }
435
435
 
436
+ function toUtf16Bytes(str) {
437
+ const bytes = new Uint8Array(str.length * 2);
438
+ for (let i = 0; i < str.length; i++) {
439
+ const code = str.charCodeAt(i);
440
+ bytes[i * 2] = code >> 8;
441
+ bytes[i * 2 + 1] = code & 0xff;
442
+ }
443
+ return bytes;
444
+ }
445
+
436
446
  function toUtf8Array (str) {
437
447
  const utf8 = []
438
448
  for (let i = 0; i < str.length; i++) {
@@ -809,7 +819,8 @@ module.exports = {
809
819
  showVersion,
810
820
  toolkitRun,
811
821
  toUpperCamelCase,
812
- toUtf8Array,
822
+ toUtf16Bytes,
823
+ toUtf8Array,
813
824
  utf8ArrayToStr,
814
825
  prompt,
815
826
  prompter,
@@ -1,25 +1,9 @@
1
- const {
2
- RadonModal,
3
- RadonScript,
4
- retrievals,
5
- types,
6
- } = require("../../../src/lib/radon")
7
-
8
1
  module.exports = {
9
- web: {
10
- WitOracleWebFileExists: new RadonModal({
11
- retrieval: retrievals.HttpHead({
12
- headers: {},
13
- script: RadonScript(types.RadonString),
14
- }),
15
- }),
16
- WitOracleWebFileSha256: {},
17
- WitOracleWebFileSha256Sealed: {},
18
- },
19
2
  web3: {
20
3
  // btc: require("./web3/btc"),
21
4
  eth: require("./web3/eth.js"),
22
5
  // sol: require("./web3/sol"),
6
+ ipfs: require("./web3/ipfs.js"),
23
7
  wit: require("./web3/wit.js"),
24
8
  },
25
9
  }
@@ -0,0 +1,19 @@
1
+ const {
2
+ RadonModal,
3
+ RadonScript,
4
+ // filters,
5
+ // reducers,
6
+ retrievals,
7
+ types,
8
+ } = require("../../../../src/lib/radon")
9
+
10
+ module.exports = {
11
+ WitOracleIpfsFileExists: new RadonModal({
12
+ retrieval: retrievals.HttpHead({
13
+ headers: {},
14
+ script: RadonScript(types.RadonString),
15
+ }),
16
+ }),
17
+ WitOracleIpfsFileSha256: {},
18
+ WitOracleIpfsFileSha256Sealed: {},
19
+ }
@@ -1,8 +1,6 @@
1
1
  const {
2
2
  RadonModal,
3
3
  RadonScript,
4
- // filters,
5
- // reducers,
6
4
  retrievals,
7
5
  types,
8
6
  } = require("../../../../src/lib/radon")
@@ -11,13 +9,13 @@ module.exports = {
11
9
  WitOracleWitGetBalance: new RadonModal({
12
10
  retrieval: retrievals.JsonRPC({
13
11
  rpc: retrievals.rpc.wit.getBalance("\\1\\"),
14
- script: RadonScript(types.RadonString).asFloat().floor(),
12
+ script: RadonScript(types.RadonString).parseJSONMap().getMap("result").values(),
15
13
  }),
16
14
  }),
17
- WitOracleWitGetTransaction: new RadonModal({
15
+ WitOracleWitGetValueTransfer: new RadonModal({
18
16
  retrieval: retrievals.JsonRPC({
19
- rpc: retrievals.rpc.wit.getTransaction("\\1\\"),
20
- script: RadonScript(types.RadonString).parseJSONMap().getMap("result"),
17
+ rpc: retrievals.rpc.wit.getValueTransfer("\\1\\", "\\2\\"),
18
+ script: RadonScript(types.RadonString).parseJSONMap().getMap("result").getMap("\\2\\").values(),
21
19
  }),
22
20
  }),
23
21
  }
@@ -8,6 +8,7 @@ const {
8
8
  } = require("../../src/lib/radon")
9
9
 
10
10
  module.exports = {
11
+
11
12
  defi: {
12
13
  tickers: {
13
14
  crypto: {