@solana-mobile/dapp-store-publishing-tools 0.4.2 → 0.4.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 (92) hide show
  1. package/lib/CoreUtils.js +226 -0
  2. package/lib/create/AppCore.js +197 -0
  3. package/lib/create/PublisherCore.js +186 -0
  4. package/lib/create/ReleaseCore.js +709 -0
  5. package/lib/{esm/create → create}/index.js +0 -1
  6. package/lib/generated/appJsonMetadata.d.js +5 -0
  7. package/lib/{esm/generated → generated}/index.js +0 -1
  8. package/lib/generated/publisherJsonMetadata.d.js +5 -0
  9. package/lib/generated/releaseJsonMetadata.d.js +5 -0
  10. package/lib/{esm/index.js → index.js} +0 -1
  11. package/lib/publish/PublishCoreAttestation.js +161 -0
  12. package/lib/publish/PublishCoreRemove.js +224 -0
  13. package/lib/publish/PublishCoreSubmit.js +236 -0
  14. package/lib/publish/PublishCoreSupport.js +221 -0
  15. package/lib/publish/PublishCoreUpdate.js +236 -0
  16. package/lib/publish/dapp_publisher_portal.js +202 -0
  17. package/lib/{esm/publish → publish}/index.js +0 -1
  18. package/lib/publish/types.js +1 -0
  19. package/lib/schemas/appJsonMetadata.json +58 -0
  20. package/lib/schemas/publisherJsonMetadata.json +85 -0
  21. package/lib/schemas/releaseJsonMetadata.json +230 -0
  22. package/lib/types/index.d.js +0 -0
  23. package/lib/types.js +1 -0
  24. package/lib/validate/CoreValidation.js +99 -0
  25. package/package.json +9 -6
  26. package/lib/esm/CoreUtils.js +0 -22
  27. package/lib/esm/CoreUtils.js.map +0 -1
  28. package/lib/esm/create/AppCore.js +0 -47
  29. package/lib/esm/create/AppCore.js.map +0 -1
  30. package/lib/esm/create/PublisherCore.js +0 -43
  31. package/lib/esm/create/PublisherCore.js.map +0 -1
  32. package/lib/esm/create/ReleaseCore.js +0 -141
  33. package/lib/esm/create/ReleaseCore.js.map +0 -1
  34. package/lib/esm/create/index.js.map +0 -1
  35. package/lib/esm/generated/index.js.map +0 -1
  36. package/lib/esm/index.js.map +0 -1
  37. package/lib/esm/publish/PublishCoreAttestation.js +0 -14
  38. package/lib/esm/publish/PublishCoreAttestation.js.map +0 -1
  39. package/lib/esm/publish/PublishCoreRemove.js +0 -62
  40. package/lib/esm/publish/PublishCoreRemove.js.map +0 -1
  41. package/lib/esm/publish/PublishCoreSubmit.js +0 -74
  42. package/lib/esm/publish/PublishCoreSubmit.js.map +0 -1
  43. package/lib/esm/publish/PublishCoreSupport.js +0 -59
  44. package/lib/esm/publish/PublishCoreSupport.js.map +0 -1
  45. package/lib/esm/publish/PublishCoreUpdate.js +0 -74
  46. package/lib/esm/publish/PublishCoreUpdate.js.map +0 -1
  47. package/lib/esm/publish/dapp_publisher_portal.js +0 -57
  48. package/lib/esm/publish/dapp_publisher_portal.js.map +0 -1
  49. package/lib/esm/publish/index.js.map +0 -1
  50. package/lib/esm/publish/types.js +0 -2
  51. package/lib/esm/publish/types.js.map +0 -1
  52. package/lib/esm/schemas/appJsonMetadata.json +0 -58
  53. package/lib/esm/schemas/publisherJsonMetadata.json +0 -85
  54. package/lib/esm/schemas/releaseJsonMetadata.json +0 -230
  55. package/lib/esm/types.js +0 -2
  56. package/lib/esm/types.js.map +0 -1
  57. package/lib/esm/validate/CoreValidation.js +0 -57
  58. package/lib/esm/validate/CoreValidation.js.map +0 -1
  59. package/lib/types/CoreUtils.d.ts +0 -11
  60. package/lib/types/CoreUtils.d.ts.map +0 -1
  61. package/lib/types/create/AppCore.d.ts +0 -11
  62. package/lib/types/create/AppCore.d.ts.map +0 -1
  63. package/lib/types/create/PublisherCore.d.ts +0 -11
  64. package/lib/types/create/PublisherCore.d.ts.map +0 -1
  65. package/lib/types/create/ReleaseCore.d.ts +0 -20
  66. package/lib/types/create/ReleaseCore.d.ts.map +0 -1
  67. package/lib/types/create/index.d.ts +0 -4
  68. package/lib/types/create/index.d.ts.map +0 -1
  69. package/lib/types/generated/index.d.ts +0 -4
  70. package/lib/types/generated/index.d.ts.map +0 -1
  71. package/lib/types/index.d.ts +0 -5
  72. package/lib/types/index.d.ts.map +0 -1
  73. package/lib/types/publish/PublishCoreAttestation.d.ts +0 -7
  74. package/lib/types/publish/PublishCoreAttestation.d.ts.map +0 -1
  75. package/lib/types/publish/PublishCoreRemove.d.ts +0 -11
  76. package/lib/types/publish/PublishCoreRemove.d.ts.map +0 -1
  77. package/lib/types/publish/PublishCoreSubmit.d.ts +0 -12
  78. package/lib/types/publish/PublishCoreSubmit.d.ts.map +0 -1
  79. package/lib/types/publish/PublishCoreSupport.d.ts +0 -11
  80. package/lib/types/publish/PublishCoreSupport.d.ts.map +0 -1
  81. package/lib/types/publish/PublishCoreUpdate.d.ts +0 -13
  82. package/lib/types/publish/PublishCoreUpdate.d.ts.map +0 -1
  83. package/lib/types/publish/dapp_publisher_portal.d.ts +0 -26
  84. package/lib/types/publish/dapp_publisher_portal.d.ts.map +0 -1
  85. package/lib/types/publish/index.d.ts +0 -6
  86. package/lib/types/publish/index.d.ts.map +0 -1
  87. package/lib/types/publish/types.d.ts +0 -8
  88. package/lib/types/publish/types.d.ts.map +0 -1
  89. package/lib/types/types.d.ts +0 -76
  90. package/lib/types/types.d.ts.map +0 -1
  91. package/lib/types/validate/CoreValidation.d.ts +0 -6
  92. package/lib/types/validate/CoreValidation.d.ts.map +0 -1
@@ -0,0 +1,58 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "schema_version": {
5
+ "type": "string"
6
+ },
7
+ "name": {
8
+ "type": "string",
9
+ "maxLength": 32
10
+ },
11
+ "image": {
12
+ "type": "string"
13
+ },
14
+ "properties": {
15
+ "type": "object",
16
+ "properties": {
17
+ "category": {
18
+ "type": "string"
19
+ },
20
+ "creators": {
21
+ "type": "array",
22
+ "items": {
23
+ "type": "object",
24
+ "properties": {
25
+ "address": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "required": ["address"]
30
+ }
31
+ }
32
+ },
33
+ "required": ["category", "creators"]
34
+ },
35
+ "extensions": {
36
+ "type": "object",
37
+ "properties": {
38
+ "solana_dapp_store": {
39
+ "type": "object",
40
+ "properties": {
41
+ "android_package": {
42
+ "type": "string"
43
+ }
44
+ },
45
+ "required": ["android_package"]
46
+ }
47
+ },
48
+ "required": ["solana_dapp_store"]
49
+ }
50
+ },
51
+ "required": [
52
+ "schema_version",
53
+ "name",
54
+ "image",
55
+ "properties",
56
+ "extensions"
57
+ ]
58
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "schema_version": {
5
+ "type": "string"
6
+ },
7
+ "name": {
8
+ "type": "string",
9
+ "maxLength": 32
10
+ },
11
+ "image": {
12
+ "type": "string"
13
+ },
14
+ "properties": {
15
+ "type": "object",
16
+ "properties": {
17
+ "category": {
18
+ "type": "string"
19
+ },
20
+ "creators": {
21
+ "type": "array",
22
+ "items": {
23
+ "type": "object",
24
+ "properties": {
25
+ "address": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "required": [
30
+ "address"
31
+ ]
32
+ }
33
+ }
34
+ },
35
+ "required": [
36
+ "category",
37
+ "creators"
38
+ ]
39
+ },
40
+ "extensions": {
41
+ "type": "object",
42
+ "properties": {
43
+ "solana_dapp_store": {
44
+ "type": "object",
45
+ "properties": {
46
+ "publisher_details": {
47
+ "type": "object",
48
+ "properties": {
49
+ "name": {
50
+ "type": "string"
51
+ },
52
+ "website": {
53
+ "type": "string",
54
+ "pattern": "^https://"
55
+ },
56
+ "contact": {
57
+ "type": "string",
58
+ "pattern": "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
59
+ }
60
+ },
61
+ "required": [
62
+ "name",
63
+ "website",
64
+ "contact"
65
+ ]
66
+ }
67
+ },
68
+ "required": [
69
+ "publisher_details"
70
+ ]
71
+ }
72
+ },
73
+ "required": [
74
+ "solana_dapp_store"
75
+ ]
76
+ }
77
+ },
78
+ "required": [
79
+ "schema_version",
80
+ "name",
81
+ "image",
82
+ "properties",
83
+ "extensions"
84
+ ]
85
+ }
@@ -0,0 +1,230 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "schema_version": {
5
+ "type": "string"
6
+ },
7
+ "name": {
8
+ "type": "string",
9
+ "maxLength": 32
10
+ },
11
+ "description": {
12
+ "type": "string"
13
+ },
14
+ "image": {
15
+ "type": "string"
16
+ },
17
+ "properties": {
18
+ "type": "object",
19
+ "properties": {
20
+ "category": {
21
+ "type": "string"
22
+ },
23
+ "creators": {
24
+ "type": "array",
25
+ "items": {
26
+ "type": "object",
27
+ "properties": {
28
+ "address": {
29
+ "type": "string"
30
+ }
31
+ },
32
+ "required": ["address"]
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "extensions": {
38
+ "type": "object",
39
+ "properties": {
40
+ "solana_dapp_store": {
41
+ "type": "object",
42
+ "properties": {
43
+ "publisher_details": {
44
+ "type": "object",
45
+ "properties": {
46
+ "name": {
47
+ "type": "string"
48
+ },
49
+ "website": {
50
+ "type": "string",
51
+ "pattern": "^https://"
52
+ },
53
+ "contact": {
54
+ "type": "string",
55
+ "pattern": "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
56
+ }
57
+ },
58
+ "required": ["name", "website", "contact"]
59
+ },
60
+ "release_details": {
61
+ "type": "object",
62
+ "properties": {
63
+ "updated_on": {
64
+ "type": "string"
65
+ },
66
+ "license_url": {
67
+ "type": "string",
68
+ "pattern": "^https://"
69
+ },
70
+ "copyright_url": {
71
+ "type": "string",
72
+ "pattern": "^https://"
73
+ },
74
+ "privacy_policy_url": {
75
+ "type": "string",
76
+ "pattern": "^https://"
77
+ },
78
+ "localized_resources": {
79
+ "type": "object",
80
+ "properties": {
81
+ "short_description": {
82
+ "type": "string",
83
+ "maxLength": 50
84
+ },
85
+ "long_description": {
86
+ "type": "string"
87
+ },
88
+ "new_in_version": {
89
+ "type": "string"
90
+ },
91
+ "saga_features": {
92
+ "type": "string"
93
+ },
94
+ "name": {
95
+ "type": "string"
96
+ }
97
+ },
98
+ "required": ["short_description", "long_description", "new_in_version", "name"]
99
+ }
100
+ },
101
+ "required": [
102
+ "updated_on",
103
+ "license_url",
104
+ "copyright_url",
105
+ "privacy_policy_url",
106
+ "localized_resources"
107
+ ]
108
+ },
109
+ "media": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "object",
113
+ "properties": {
114
+ "mime": {
115
+ "type": "string"
116
+ },
117
+ "purpose": {
118
+ "type": "string"
119
+ },
120
+ "width": {
121
+ "type": "integer"
122
+ },
123
+ "height": {
124
+ "type": "integer"
125
+ },
126
+ "sha256": {
127
+ "type": "string"
128
+ },
129
+ "uri": {
130
+ "type": "string"
131
+ }
132
+ },
133
+ "required": ["mime", "purpose", "width", "height", "sha256"]
134
+ }
135
+ },
136
+ "files": {
137
+ "type": "array",
138
+ "items": {
139
+ "type": "object",
140
+ "properties": {
141
+ "mime": {
142
+ "type": "string"
143
+ },
144
+ "purpose": {
145
+ "type": "string"
146
+ },
147
+ "size": {
148
+ "type": "integer"
149
+ },
150
+ "sha256": {
151
+ "type": "string"
152
+ },
153
+ "uri": {
154
+ "type": "string"
155
+ }
156
+ },
157
+ "required": ["mime", "purpose", "size", "sha256"]
158
+ }
159
+ },
160
+ "android_details": {
161
+ "type": "object",
162
+ "properties": {
163
+ "android_package": {
164
+ "type": "string"
165
+ },
166
+ "version_code": {
167
+ "type": "integer"
168
+ },
169
+ "version": {
170
+ "type": "string"
171
+ },
172
+ "min_sdk": {
173
+ "type": "integer"
174
+ },
175
+ "permissions": {
176
+ "type": "array",
177
+ "items": {
178
+ "type": "string"
179
+ }
180
+ },
181
+ "locales": {
182
+ "type": "array",
183
+ "items": {
184
+ "type": "string"
185
+ }
186
+ }
187
+ },
188
+ "required": [
189
+ "android_package",
190
+ "version_code",
191
+ "version",
192
+ "min_sdk",
193
+ "permissions",
194
+ "locales"
195
+ ]
196
+ }
197
+ },
198
+ "required": [
199
+ "publisher_details",
200
+ "release_details",
201
+ "media",
202
+ "files",
203
+ "android_details"
204
+ ]
205
+ },
206
+ "i18n": {
207
+ "type": "object",
208
+ "patternProperties": {
209
+ "^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{2,8})*$": {
210
+ "type": "object",
211
+ "additionalProperties": {
212
+ "type": "string"
213
+ }
214
+ }
215
+ },
216
+ "additionalProperties": false
217
+ }
218
+ },
219
+ "required": ["solana_dapp_store", "i18n"]
220
+ }
221
+ },
222
+ "required": [
223
+ "schema_version",
224
+ "name",
225
+ "description",
226
+ "image",
227
+ "properties",
228
+ "extensions"
229
+ ]
230
+ }
File without changes
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,99 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ import Ajv from "ajv";
30
+ // eslint-disable-next-line require-extensions/require-extensions
31
+ import publisherSchema from "../schemas/publisherJsonMetadata.json" assert {
32
+ type: "json"
33
+ };
34
+ // eslint-disable-next-line require-extensions/require-extensions
35
+ import appSchema from "../schemas/appJsonMetadata.json" assert {
36
+ type: "json"
37
+ };
38
+ // eslint-disable-next-line require-extensions/require-extensions
39
+ import releaseSchema from "../schemas/releaseJsonMetadata.json" assert {
40
+ type: "json"
41
+ };
42
+ import { isMetaplexFile } from "@metaplex-foundation/js";
43
+ export var metaplexFileReplacer = function(k, v) {
44
+ if (isMetaplexFile(v)) {
45
+ return "https://temp-asset-path";
46
+ }
47
+ return v;
48
+ };
49
+ export var validatePublisher = function(publisherJson) {
50
+ var jsonToValidate = _object_spread({}, publisherJson);
51
+ if (typeof jsonToValidate.image !== "string") {
52
+ var _jsonToValidate_image;
53
+ jsonToValidate.image = (_jsonToValidate_image = jsonToValidate.image) === null || _jsonToValidate_image === void 0 ? void 0 : _jsonToValidate_image.fileName;
54
+ }
55
+ var ajv = new Ajv({
56
+ strictTuples: false
57
+ });
58
+ var validate = ajv.compile(publisherSchema);
59
+ var valid = validate(jsonToValidate);
60
+ if (!valid) {
61
+ console.error(validate.errors);
62
+ throw new Error("Publisher JSON not valid");
63
+ }
64
+ return valid;
65
+ };
66
+ export var validateApp = function(appJson) {
67
+ var jsonToValidate = _object_spread({}, appJson);
68
+ if (typeof jsonToValidate.image !== "string") {
69
+ var _jsonToValidate_image;
70
+ jsonToValidate.image = (_jsonToValidate_image = jsonToValidate.image) === null || _jsonToValidate_image === void 0 ? void 0 : _jsonToValidate_image.fileName;
71
+ }
72
+ var ajv = new Ajv({
73
+ strictTuples: false
74
+ });
75
+ var validate = ajv.compile(appSchema);
76
+ var valid = validate(jsonToValidate);
77
+ if (!valid) {
78
+ console.error(validate.errors);
79
+ throw new Error("App JSON not valid");
80
+ }
81
+ return valid;
82
+ };
83
+ export var validateRelease = function(releaseJson) {
84
+ var jsonToValidate = _object_spread({}, releaseJson);
85
+ if (typeof jsonToValidate.image !== "string") {
86
+ var _jsonToValidate_image;
87
+ jsonToValidate.image = (_jsonToValidate_image = jsonToValidate.image) === null || _jsonToValidate_image === void 0 ? void 0 : _jsonToValidate_image.fileName;
88
+ }
89
+ var ajv = new Ajv({
90
+ strictTuples: false
91
+ });
92
+ var validate = ajv.compile(releaseSchema);
93
+ var valid = validate(jsonToValidate);
94
+ if (!valid) {
95
+ console.error(validate.errors);
96
+ throw new Error("Release JSON not valid");
97
+ }
98
+ return valid;
99
+ };
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@solana-mobile/dapp-store-publishing-tools",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
- "main": "./lib/cjs/index.js",
8
- "module": "./lib/esm/index.js",
7
+ "main": "./lib/index.js",
8
+ "module": "./lib/index.js",
9
9
  "types": "./lib/types/index.d.ts",
10
10
  "engines": {
11
11
  "node": ">=18"
12
12
  },
13
13
  "exports": {
14
- "import": "./lib/esm/index.js",
15
- "require": "./lib/cjs/index.js",
14
+ "import": "./lib/index.js",
15
+ "require": "./lib/index.js",
16
16
  "types": "./lib/types/index.d.ts"
17
17
  },
18
18
  "files": [
@@ -31,10 +31,11 @@
31
31
  "shx": "^0.3.4"
32
32
  },
33
33
  "dependencies": {
34
- "@metaplex-foundation/js": "0.17.11",
34
+ "@metaplex-foundation/js": "0.18.3",
35
35
  "@solana/web3.js": "1.68.0",
36
36
  "ajv": "^8.11.0",
37
37
  "axios": "1.1.3",
38
+ "chokidar": "^3.5.3",
38
39
  "debug": "^4.3.4",
39
40
  "image-size": "^1.0.2",
40
41
  "mime": "^3.0.0"
@@ -42,6 +43,8 @@
42
43
  "scripts": {
43
44
  "clean": "shx mkdir -p lib && shx rm -rf lib",
44
45
  "prebuild": "pnpm run clean && pnpm run generate-types",
46
+ "build": "swc src -d lib --copy-files",
47
+ "watch": "swc src --out-dir lib -w",
45
48
  "generate-types": "json2ts -i src/schemas -o src/generated"
46
49
  }
47
50
  }
@@ -1,22 +0,0 @@
1
- export class Constants {
2
- }
3
- Constants.PUBLISHING_SCHEMA_VER = "0.2.5";
4
- export const truncateAddress = (address) => {
5
- return `${address.slice(0, 4)}...${address.slice(address.length - 4, address.length)}`;
6
- };
7
- export const mintNft = async (metaplex, json, createNftInput) => {
8
- console.info({ json });
9
- const { uri } = await metaplex.nfts().uploadMetadata(json);
10
- const txBuilder = await metaplex
11
- .nfts()
12
- .builders()
13
- .create({
14
- ...createNftInput,
15
- uri,
16
- // @ts-ignore
17
- name: json.name,
18
- sellerFeeBasisPoints: 0,
19
- });
20
- return txBuilder;
21
- };
22
- //# sourceMappingURL=CoreUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreUtils.js","sourceRoot":"","sources":["../../src/CoreUtils.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,SAAS;;AACb,+BAAqB,GAAG,OAAO,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,EAAE;IACjD,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAC9C,OAAO,CAAC,MAAM,GAAG,CAAC,EAClB,OAAO,CAAC,MAAM,CACf,EAAE,CAAC;AACN,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,QAAkB,EAClB,IAA8B,EAC9B,cAA6E,EAChD,EAAE;IAC/B,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAE3D,MAAM,SAAS,GAAG,MAAM,QAAQ;SAC7B,IAAI,EAAE;SACN,QAAQ,EAAE;SACV,MAAM,CAAC;QACN,GAAG,cAAc;QACjB,GAAG;QACH,aAAa;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,oBAAoB,EAAE,CAAC;KACxB,CAAC,CAAC;IAEL,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -1,47 +0,0 @@
1
- import { Constants, mintNft } from "../CoreUtils.js";
2
- import debugModule from "debug";
3
- import { validateApp } from "../validate/CoreValidation.js";
4
- const debug = debugModule("APP");
5
- export const createAppJson = (app, publisherAddress) => {
6
- const appMetadata = {
7
- schema_version: Constants.PUBLISHING_SCHEMA_VER,
8
- name: app.name,
9
- image: app.icon,
10
- external_url: app.urls.website,
11
- properties: {
12
- category: "dApp",
13
- creators: [
14
- {
15
- address: publisherAddress.toBase58(),
16
- share: 100,
17
- },
18
- ],
19
- },
20
- extensions: {
21
- solana_dapp_store: {
22
- android_package: app.android_package,
23
- },
24
- },
25
- };
26
- return appMetadata;
27
- };
28
- export const createApp = async ({ publisherMintAddress, mintAddress, appDetails }, { metaplex, publisher }) => {
29
- debug(`Minting app NFT for publisher: ${publisherMintAddress.toBase58()}`);
30
- const appJson = createAppJson(appDetails, publisher.publicKey);
31
- validateApp(appJson);
32
- const txBuilder = await mintNft(metaplex, appJson, {
33
- useNewMint: mintAddress,
34
- collection: publisherMintAddress,
35
- collectionAuthority: publisher,
36
- isCollection: true,
37
- isMutable: true,
38
- creators: [{ address: publisher.publicKey, share: 100 }],
39
- });
40
- txBuilder.append(metaplex.nfts().builders().verifyCreator({
41
- mintAddress: mintAddress.publicKey,
42
- creator: publisher,
43
- }));
44
- debug({ appNft: mintAddress.publicKey.toBase58() });
45
- return txBuilder;
46
- };
47
- //# sourceMappingURL=AppCore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppCore.js","sourceRoot":"","sources":["../../../src/create/AppCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,GAAQ,EACR,gBAA2B,EACd,EAAE;IACf,MAAM,WAAW,GAAG;QAClB,cAAc,EAAE,SAAS,CAAC,qBAAqB;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,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEpD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -1,43 +0,0 @@
1
- import debugModule from "debug";
2
- import { validatePublisher } from "../validate/CoreValidation.js";
3
- import { Constants, mintNft } from "../CoreUtils.js";
4
- const debug = debugModule("PUBLISHER");
5
- export const createPublisherJson = (publisher) => {
6
- const publisherMetadata = {
7
- schema_version: Constants.PUBLISHING_SCHEMA_VER,
8
- name: publisher.name,
9
- image: publisher.icon,
10
- external_url: publisher.website,
11
- properties: {
12
- category: "dApp",
13
- creators: [
14
- {
15
- address: publisher.address,
16
- share: 100,
17
- },
18
- ],
19
- },
20
- extensions: {
21
- solana_dapp_store: {
22
- publisher_details: {
23
- name: publisher.name,
24
- website: publisher.website,
25
- contact: publisher.email,
26
- },
27
- },
28
- },
29
- };
30
- return publisherMetadata;
31
- };
32
- export const createPublisher = async ({ mintAddress, publisherDetails }, { metaplex }) => {
33
- debug(`Minting publisher NFT`);
34
- const publisherJson = createPublisherJson(publisherDetails);
35
- validatePublisher(publisherJson);
36
- const txBuilder = await mintNft(metaplex, publisherJson, {
37
- isCollection: true,
38
- isMutable: true,
39
- useNewMint: mintAddress,
40
- });
41
- return txBuilder;
42
- };
43
- //# sourceMappingURL=PublisherCore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PublisherCore.js","sourceRoot":"","sources":["../../../src/create/PublisherCore.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,SAAoB,EACD,EAAE;IACrB,MAA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