@secondlayer/stacks 6.4.0 → 6.4.1

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.
@@ -4038,64 +4038,6 @@ var SIP013_ABI = {
4038
4038
  var sip010Abi = SIP010_ABI;
4039
4039
  var sip009Abi = SIP009_ABI;
4040
4040
  var sip013Abi = SIP013_ABI;
4041
- // src/clarity/abi/classify.ts
4042
- var TRAIT_STANDARDS = ["sip-009", "sip-010", "sip-013"];
4043
- var STANDARDS = [
4044
- { id: "sip-010", abi: SIP010_ABI, optional: new Set(["get-token-uri"]) },
4045
- { id: "sip-009", abi: SIP009_ABI, optional: new Set(["get-token-uri"]) },
4046
- {
4047
- id: "sip-013",
4048
- abi: SIP013_ABI,
4049
- optional: new Set([
4050
- "transfer-memo",
4051
- "transfer-many",
4052
- "transfer-many-memo",
4053
- "get-token-uri",
4054
- "get-overall-balance",
4055
- "get-overall-supply"
4056
- ])
4057
- }
4058
- ];
4059
- function indexByName(abi) {
4060
- const m = new Map;
4061
- for (const f of abi.functions)
4062
- m.set(f.name, f);
4063
- return m;
4064
- }
4065
- function conformsTo(candidate, spec) {
4066
- const fns = indexByName(candidate);
4067
- for (const required of spec.abi.functions) {
4068
- if (spec.optional.has(required.name))
4069
- continue;
4070
- const got = fns.get(required.name);
4071
- if (!got)
4072
- return false;
4073
- if (got.access !== required.access)
4074
- return false;
4075
- if (got.args.length !== required.args.length)
4076
- return false;
4077
- }
4078
- return true;
4079
- }
4080
- function classifyContract(abi) {
4081
- if (!abi || !Array.isArray(abi.functions))
4082
- return [];
4083
- return STANDARDS.filter((s) => conformsTo(abi, s)).map((s) => s.id);
4084
- }
4085
- function parseDeclaredStandards(claritySource) {
4086
- const out = new Set;
4087
- const matches = claritySource.matchAll(/\(impl-trait\s+[^)]+\)/gi);
4088
- for (const m of matches) {
4089
- const ref = m[0].toLowerCase();
4090
- if (ref.includes("sip-010") || ref.includes(".ft-trait"))
4091
- out.add("sip-010");
4092
- if (ref.includes("sip-009") || ref.includes("nft-trait"))
4093
- out.add("sip-009");
4094
- if (ref.includes("sip-013") || ref.includes("semi-fungible"))
4095
- out.add("sip-013");
4096
- }
4097
- return [...out];
4098
- }
4099
4041
  // src/clarity/abi/normalize.ts
4100
4042
  function normalizeAccess(access) {
4101
4043
  if (access === "read_only")
@@ -4302,6 +4244,65 @@ function normalizeAbi(abi) {
4302
4244
  defined_traits: definedTraits.length > 0 ? definedTraits : undefined
4303
4245
  };
4304
4246
  }
4247
+
4248
+ // src/clarity/abi/classify.ts
4249
+ var TRAIT_STANDARDS = ["sip-009", "sip-010", "sip-013"];
4250
+ var STANDARDS = [
4251
+ { id: "sip-010", abi: SIP010_ABI, optional: new Set(["get-token-uri"]) },
4252
+ { id: "sip-009", abi: SIP009_ABI, optional: new Set(["get-token-uri"]) },
4253
+ {
4254
+ id: "sip-013",
4255
+ abi: SIP013_ABI,
4256
+ optional: new Set([
4257
+ "transfer-memo",
4258
+ "transfer-many",
4259
+ "transfer-many-memo",
4260
+ "get-token-uri",
4261
+ "get-overall-balance",
4262
+ "get-overall-supply"
4263
+ ])
4264
+ }
4265
+ ];
4266
+ function indexByName(abi) {
4267
+ const m = new Map;
4268
+ for (const f of abi.functions)
4269
+ m.set(f.name, f);
4270
+ return m;
4271
+ }
4272
+ function conformsTo(candidate, spec) {
4273
+ const fns = indexByName(candidate);
4274
+ for (const required of spec.abi.functions) {
4275
+ if (spec.optional.has(required.name))
4276
+ continue;
4277
+ const got = fns.get(required.name);
4278
+ if (!got)
4279
+ return false;
4280
+ if (normalizeAccess(got.access) !== required.access)
4281
+ return false;
4282
+ if (got.args.length !== required.args.length)
4283
+ return false;
4284
+ }
4285
+ return true;
4286
+ }
4287
+ function classifyContract(abi) {
4288
+ if (!abi || !Array.isArray(abi.functions))
4289
+ return [];
4290
+ return STANDARDS.filter((s) => conformsTo(abi, s)).map((s) => s.id);
4291
+ }
4292
+ function parseDeclaredStandards(claritySource) {
4293
+ const out = new Set;
4294
+ const matches = claritySource.matchAll(/\(impl-trait\s+[^)]+\)/gi);
4295
+ for (const m of matches) {
4296
+ const ref = m[0].toLowerCase();
4297
+ if (ref.includes("sip-010") || ref.includes(".ft-trait"))
4298
+ out.add("sip-010");
4299
+ if (ref.includes("sip-009") || ref.includes("nft-trait"))
4300
+ out.add("sip-009");
4301
+ if (ref.includes("sip-013") || ref.includes("semi-fungible"))
4302
+ out.add("sip-013");
4303
+ }
4304
+ return [...out];
4305
+ }
4305
4306
  // src/postconditions/index.ts
4306
4307
  var exports_postconditions = {};
4307
4308
  __export(exports_postconditions, {
@@ -5045,5 +5046,5 @@ function bns() {
5045
5046
  });
5046
5047
  }
5047
5048
 
5048
- //# debugId=34914284F2E2E81C64756E2164756E21
5049
+ //# debugId=A5427995C638B39164756E2164756E21
5049
5050
  //# sourceMappingURL=index.cjs.map