@buenos_andres/contracts 0.0.1-test.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.
Files changed (33) hide show
  1. package/dist/access/AccessControl.compact +321 -0
  2. package/dist/access/Ownable.compact +212 -0
  3. package/dist/access/witnesses/AccessControlWitnesses.d.ts +2 -0
  4. package/dist/access/witnesses/AccessControlWitnesses.js +1 -0
  5. package/dist/access/witnesses/AccessControlWitnesses.ts +3 -0
  6. package/dist/access/witnesses/OwnableWitnesses.d.ts +2 -0
  7. package/dist/access/witnesses/OwnableWitnesses.js +1 -0
  8. package/dist/access/witnesses/OwnableWitnesses.ts +3 -0
  9. package/dist/security/Initializable.compact +59 -0
  10. package/dist/security/Pausable.compact +88 -0
  11. package/dist/security/witnesses/InitializableWitnesses.d.ts +2 -0
  12. package/dist/security/witnesses/InitializableWitnesses.js +1 -0
  13. package/dist/security/witnesses/InitializableWitnesses.ts +3 -0
  14. package/dist/security/witnesses/PausableWitnesses.d.ts +2 -0
  15. package/dist/security/witnesses/PausableWitnesses.js +1 -0
  16. package/dist/security/witnesses/PausableWitnesses.ts +3 -0
  17. package/dist/token/FungibleToken.compact +606 -0
  18. package/dist/token/MultiToken.compact +545 -0
  19. package/dist/token/NonFungibleToken.compact +805 -0
  20. package/dist/token/witnesses/FungibleTokenWitnesses.d.ts +2 -0
  21. package/dist/token/witnesses/FungibleTokenWitnesses.js +1 -0
  22. package/dist/token/witnesses/FungibleTokenWitnesses.ts +3 -0
  23. package/dist/token/witnesses/MultiTokenWitnesses.d.ts +2 -0
  24. package/dist/token/witnesses/MultiTokenWitnesses.js +1 -0
  25. package/dist/token/witnesses/MultiTokenWitnesses.ts +3 -0
  26. package/dist/token/witnesses/NonFungibleTokenWitnesses.d.ts +2 -0
  27. package/dist/token/witnesses/NonFungibleTokenWitnesses.js +1 -0
  28. package/dist/token/witnesses/NonFungibleTokenWitnesses.ts +3 -0
  29. package/dist/utils/Utils.compact +77 -0
  30. package/dist/utils/witnesses/UtilsWitnesses.d.ts +2 -0
  31. package/dist/utils/witnesses/UtilsWitnesses.js +1 -0
  32. package/dist/utils/witnesses/UtilsWitnesses.ts +3 -0
  33. package/package.json +38 -0
@@ -0,0 +1,2 @@
1
+ export type FungibleTokenPrivateState = Record<string, never>;
2
+ export declare const FungibleTokenWitnesses: {};
@@ -0,0 +1 @@
1
+ export const FungibleTokenWitnesses = {};
@@ -0,0 +1,3 @@
1
+ // This is how we type an empty object.
2
+ export type FungibleTokenPrivateState = Record<string, never>;
3
+ export const FungibleTokenWitnesses = {};
@@ -0,0 +1,2 @@
1
+ export type MultiTokenPrivateState = Record<string, never>;
2
+ export declare const MultiTokenWitnesses: {};
@@ -0,0 +1 @@
1
+ export const MultiTokenWitnesses = {};
@@ -0,0 +1,3 @@
1
+ // This is how we type an empty object.
2
+ export type MultiTokenPrivateState = Record<string, never>;
3
+ export const MultiTokenWitnesses = {};
@@ -0,0 +1,2 @@
1
+ export type NonFungibleTokenPrivateState = Record<string, never>;
2
+ export declare const NonFungibleTokenWitnesses: {};
@@ -0,0 +1 @@
1
+ export const NonFungibleTokenWitnesses = {};
@@ -0,0 +1,3 @@
1
+ // This is how we type an empty object.
2
+ export type NonFungibleTokenPrivateState = Record<string, never>;
3
+ export const NonFungibleTokenWitnesses = {};
@@ -0,0 +1,77 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma language_version >= 0.16.0;
4
+
5
+ /**
6
+ * @module Utils.
7
+ * @description A library for common utilities used in Compact contracts.
8
+ */
9
+ module Utils {
10
+ import CompactStandardLibrary;
11
+
12
+ /**
13
+ * @description Returns whether `keyOrAddress` is the zero address.
14
+ *
15
+ * @notice Midnight's burn address is represented as left<ZswapCoinPublicKey, ContractAddress>(default<ZswapCoinPublicKey>)
16
+ * in Compact, so we've chosen to represent the zero address as this structure as well.
17
+ *
18
+ * @param {Either<ZswapCoinPublicKey, ContractAddress>} keyOrAddress - The target value to check, either a ZswapCoinPublicKey or a ContractAddress.
19
+ * @return {Boolean} - Returns true if `keyOrAddress` is zero.
20
+ */
21
+ export pure circuit isKeyOrAddressZero(keyOrAddress: Either<ZswapCoinPublicKey, ContractAddress>): Boolean {
22
+ return isContractAddress(keyOrAddress)
23
+ ? default<ContractAddress> == keyOrAddress.right
24
+ : default<ZswapCoinPublicKey> == keyOrAddress.left;
25
+ }
26
+
27
+ /**
28
+ * @description Returns whether `key` is the zero address.
29
+ *
30
+ * @param {ZswapCoinPublicKey} key - A ZswapCoinPublicKey
31
+ * @return {Boolean} - Returns true if `key` is zero.
32
+ */
33
+ export pure circuit isKeyZero(key: ZswapCoinPublicKey): Boolean {
34
+ const zero = default<ZswapCoinPublicKey>;
35
+ return zero == key;
36
+ }
37
+
38
+ /**
39
+ * @description Returns whether `keyOrAddress` is equal to `other`. Assumes that a ZswapCoinPublicKey
40
+ * and a ContractAddress can never be equal
41
+ *
42
+ * @param {Either<ZswapCoinPublicKey, ContractAddress>} keyOrAddress - The target value to check, either a ZswapCoinPublicKey or a ContractAddress.
43
+ * @param {Either<ZswapCoinPublicKey, ContractAddress>} other - The other value to check, either a ZswapCoinPublicKey or a ContractAddress.
44
+ * @return {Boolean} - Returns true if `keyOrAddress` is is equal to `other`.
45
+ */
46
+ export pure circuit isKeyOrAddressEqual(
47
+ keyOrAddress: Either<ZswapCoinPublicKey, ContractAddress>,
48
+ other: Either<ZswapCoinPublicKey, ContractAddress>
49
+ ): Boolean {
50
+ if (keyOrAddress.is_left && other.is_left) {
51
+ return keyOrAddress.left == other.left;
52
+ } else if (!keyOrAddress.is_left && !other.is_left) {
53
+ return keyOrAddress.right == other.right;
54
+ } else {
55
+ return false;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * @description Returns whether `keyOrAddress` is a ContractAddress type.
61
+ *
62
+ * @param {Either<ZswapCoinPublicKey, ContractAddress>} keyOrAddress - The target value to check, either a ZswapCoinPublicKey or a ContractAddress.
63
+ * @return {Boolean} - Returns true if `keyOrAddress` is a ContractAddress.
64
+ */
65
+ export pure circuit isContractAddress(keyOrAddress: Either<ZswapCoinPublicKey, ContractAddress>): Boolean {
66
+ return !keyOrAddress.is_left;
67
+ }
68
+
69
+ /**
70
+ * @description A helper function that returns the empty string: "".
71
+ *
72
+ * @return {Opaque<"string">} - The empty string: "".
73
+ */
74
+ export pure circuit emptyString(): Opaque<"string"> {
75
+ return default<Opaque<"string">>;
76
+ }
77
+ }
@@ -0,0 +1,2 @@
1
+ export type UtilsPrivateState = Record<string, never>;
2
+ export declare const UtilsWitnesses: {};
@@ -0,0 +1 @@
1
+ export const UtilsWitnesses = {};
@@ -0,0 +1,3 @@
1
+ // This is how we type an empty object.
2
+ export type UtilsPrivateState = Record<string, never>;
3
+ export const UtilsWitnesses = {};
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@buenos_andres/contracts",
3
+ "version": "0.0.1-test.1",
4
+ "description": "test contract stuff",
5
+ "keywords": [
6
+ "foo",
7
+ "bar"
8
+ ],
9
+ "license": "MIT",
10
+ "author": "daddy",
11
+ "type": "module",
12
+ "main": "dist/index.js",
13
+ "module": "dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ "./*": "./dist/*"
17
+ },
18
+ "files": [
19
+ "dist/**"
20
+ ],
21
+ "scripts": {
22
+ "compact": "compact-compiler",
23
+ "build": "compact-builder",
24
+ "build:dev": "compact-builder && tsc",
25
+ "test": "vitest run",
26
+ "types": "tsc -p tsconfig.json --noEmit",
27
+ "clean": "git clean -fXd"
28
+ },
29
+ "dependencies": {
30
+ "@buenos_andres/compact": "workspace:^"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "22.14.0",
34
+ "ts-node": "^10.9.2",
35
+ "typescript": "^5.2.2",
36
+ "vitest": "^3.1.3"
37
+ }
38
+ }