@stacks/rendezvous 0.7.2 → 0.7.4

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/dist/citizen.js CHANGED
@@ -379,16 +379,14 @@ const restoreSbtcBalances = (simnet, sbtcBalancesMap) => {
379
379
  * @param sweepTxId A unique hex to use for the deposit.
380
380
  */
381
381
  const mintSbtc = (simnet, amountSats, recipient, txId, sweepTxId) => {
382
- // Calling `get-burn-header` only works for past block heights. We mine one
383
- // empty Stacks block if the initial height is 0.
384
- if (simnet.blockHeight === 0) {
385
- simnet.mineEmptyBlock();
382
+ // Calling `get-burn-block-info?` only works for past burn heights. We mine
383
+ // one empty Bitcoin block if the initial height is 0 and use the previous
384
+ // burn height to retrieve the burn header hash.
385
+ if (simnet.burnBlockHeight === 0) {
386
+ simnet.mineEmptyBurnBlock();
386
387
  }
387
- const previousStacksHeight = simnet.blockHeight - 1;
388
- const burnHash = simnet.callReadOnlyFn("SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-deposit", "get-burn-header", [
389
- // (height uint)
390
- transactions_1.Cl.uint(previousStacksHeight),
391
- ], simnet.deployer).result;
388
+ const previousBurnHeight = simnet.burnBlockHeight - 1;
389
+ const burnHash = (0, transactions_1.hexToCV)(simnet.runSnippet(`(get-burn-block-info? header-hash u${previousBurnHeight})`));
392
390
  if (burnHash === null || burnHash.type === transactions_1.ClarityType.OptionalNone) {
393
391
  throw new Error("Something went wrong trying to retrieve the burn header.");
394
392
  }
@@ -404,7 +402,7 @@ const mintSbtc = (simnet, amountSats, recipient, txId, sweepTxId) => {
404
402
  // (burn-hash (buff 32))
405
403
  burnHash.value,
406
404
  // (burn-height uint)
407
- transactions_1.Cl.uint(previousStacksHeight),
405
+ transactions_1.Cl.uint(previousBurnHeight),
408
406
  // (sweep-txid (buff 32))
409
407
  transactions_1.Cl.bufferFromHex(sweepTxId),
410
408
  ], "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4").result);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/rendezvous",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Meet your contract's vulnerabilities head-on.",
5
5
  "main": "app.js",
6
6
  "bin": {
package/dist/traits.js CHANGED
@@ -17,21 +17,37 @@ const enrichInterfaceWithTraitData = (ast, traitReferenceMap, functionInterfaceL
17
17
  const enriched = new Map();
18
18
  const enrichArgs = (args, functionName, traitReferenceMap, path = []) => {
19
19
  return args.map((arg) => {
20
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
20
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
21
21
  const listNested = !arg.name;
22
22
  const currentPath = listNested ? path : [...path, arg.name];
23
+ // Exit early if the traitReferenceMap does not have anything we are
24
+ // looking for. It means that the current parameter does not have an
25
+ // associated trait reference.
26
+ if (!traitReferenceMap ||
27
+ (!traitReferenceMap[arg.name] &&
28
+ !traitReferenceMap.tuple &&
29
+ !traitReferenceMap.list &&
30
+ !traitReferenceMap.response &&
31
+ !traitReferenceMap.optional &&
32
+ !((_a = traitReferenceMap[arg.name]) === null || _a === void 0 ? void 0 : _a.tuple) &&
33
+ !((_b = traitReferenceMap[arg.name]) === null || _b === void 0 ? void 0 : _b.list) &&
34
+ !((_c = traitReferenceMap[arg.name]) === null || _c === void 0 ? void 0 : _c.response) &&
35
+ !((_d = traitReferenceMap[arg.name]) === null || _d === void 0 ? void 0 : _d.optional) &&
36
+ traitReferenceMap !== "trait_reference")) {
37
+ return arg;
38
+ }
23
39
  if (arg.type && arg.type.tuple) {
24
40
  return Object.assign(Object.assign({}, arg), { type: {
25
41
  tuple: enrichArgs(arg.type.tuple, functionName, listNested
26
42
  ? traitReferenceMap.tuple
27
- : (_a = traitReferenceMap[arg.name]) === null || _a === void 0 ? void 0 : _a.tuple, currentPath),
43
+ : (_e = traitReferenceMap[arg.name]) === null || _e === void 0 ? void 0 : _e.tuple, currentPath),
28
44
  } });
29
45
  }
30
46
  else if (arg.type && arg.type.list) {
31
47
  return Object.assign(Object.assign({}, arg), { type: {
32
48
  list: enrichArgs([arg.type.list], functionName, listNested
33
49
  ? traitReferenceMap.list
34
- : (_b = traitReferenceMap[arg.name]) === null || _b === void 0 ? void 0 : _b.list, arg.type.list.type.tuple
50
+ : (_f = traitReferenceMap[arg.name]) === null || _f === void 0 ? void 0 : _f.list, arg.type.list.type.tuple
35
51
  ? [...currentPath, "tuple"]
36
52
  : arg.type.list.type.response
37
53
  ? [...currentPath, "response"]
@@ -45,13 +61,13 @@ const enrichInterfaceWithTraitData = (ast, traitReferenceMap, functionInterfaceL
45
61
  const errorPath = listNested ? currentPath : [...currentPath, "error"];
46
62
  const okTraitReference = enrichArgs([{ name: "ok", type: arg.type.response.ok }], functionName, {
47
63
  ok: listNested
48
- ? (_c = traitReferenceMap.response) === null || _c === void 0 ? void 0 : _c.ok
49
- : (_e = (_d = traitReferenceMap[arg.name]) === null || _d === void 0 ? void 0 : _d.response) === null || _e === void 0 ? void 0 : _e.ok,
64
+ ? (_g = traitReferenceMap.response) === null || _g === void 0 ? void 0 : _g.ok
65
+ : (_j = (_h = traitReferenceMap[arg.name]) === null || _h === void 0 ? void 0 : _h.response) === null || _j === void 0 ? void 0 : _j.ok,
50
66
  }, okPath)[0];
51
67
  const errorTraitReference = enrichArgs([{ name: "error", type: arg.type.response.error }], functionName, {
52
68
  error: listNested
53
- ? (_f = traitReferenceMap.response) === null || _f === void 0 ? void 0 : _f.error
54
- : (_h = (_g = traitReferenceMap[arg.name]) === null || _g === void 0 ? void 0 : _g.response) === null || _h === void 0 ? void 0 : _h.error,
69
+ ? (_k = traitReferenceMap.response) === null || _k === void 0 ? void 0 : _k.error
70
+ : (_m = (_l = traitReferenceMap[arg.name]) === null || _l === void 0 ? void 0 : _l.response) === null || _m === void 0 ? void 0 : _m.error,
55
71
  }, errorPath)[0];
56
72
  return Object.assign(Object.assign({}, arg), { type: {
57
73
  response: {
@@ -65,7 +81,7 @@ const enrichInterfaceWithTraitData = (ast, traitReferenceMap, functionInterfaceL
65
81
  const optionalTraitReference = enrichArgs([{ name: "optional", type: arg.type.optional }], functionName, {
66
82
  optional: listNested
67
83
  ? traitReferenceMap.optional
68
- : (_j = traitReferenceMap[arg.name]) === null || _j === void 0 ? void 0 : _j.optional,
84
+ : (_o = traitReferenceMap[arg.name]) === null || _o === void 0 ? void 0 : _o.optional,
69
85
  }, optionalPath)[0];
70
86
  return Object.assign(Object.assign({}, arg), { type: {
71
87
  optional: optionalTraitReference.type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/rendezvous",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Meet your contract's vulnerabilities head-on.",
5
5
  "main": "app.js",
6
6
  "bin": {