@unchainedshop/plugins 2.0.0-beta4 → 2.0.0-beta6

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,125 @@
1
+ import { WarehousingDirector, WarehousingAdapter, WarehousingProviderType, } from '@unchainedshop/core-warehousing';
2
+ import { ProductType, ProductContractStandard } from '@unchainedshop/types/products';
3
+ import { generateDbObjectId, systemLocale } from '@unchainedshop/utils';
4
+ const { MINTER_TOKEN_OFFSET = '0' } = process.env;
5
+ const ETHMinter = {
6
+ ...WarehousingAdapter,
7
+ key: 'shop.unchained.warehousing.infinite-minter',
8
+ version: '1.0',
9
+ label: 'Infinite Minter',
10
+ orderIndex: 0,
11
+ initialConfiguration: [{ key: 'chainId', value: '0' }],
12
+ typeSupported: (type) => {
13
+ return type === WarehousingProviderType.VIRTUAL;
14
+ },
15
+ actions: (configuration, context) => {
16
+ const { product, orderPosition, token, modules, localeContext } = context;
17
+ return {
18
+ ...WarehousingAdapter.actions(configuration, context),
19
+ isActive() {
20
+ return product?.type === ProductType.TokenizedProduct;
21
+ },
22
+ configurationError() {
23
+ return null;
24
+ },
25
+ stock: async () => {
26
+ const existingTokens = await modules.warehousing.findTokens(product.tokenization.contractStandard === 'ERC721'
27
+ ? { contractAddress: product.tokenization.contractAddress }
28
+ : {
29
+ contractAddress: product.tokenization.contractAddress,
30
+ chainTokenId: product.tokenization.tokenId,
31
+ });
32
+ const tokensCreated = existingTokens.reduce((acc, curToken) => {
33
+ return acc + curToken.quantity;
34
+ }, 0);
35
+ return product?.tokenization?.supply ? product.tokenization.supply - tokensCreated : 0;
36
+ },
37
+ tokenize: async () => {
38
+ // Upload Image to IPFS
39
+ // Upload Metadata to IPFS
40
+ // Prepare metadata
41
+ const chainId = configuration.find(({ key }) => key === 'chainId')?.value || undefined;
42
+ const { contractAddress, contractStandard, tokenId } = product?.tokenization || {};
43
+ const _id = generateDbObjectId();
44
+ const meta = { contractStandard };
45
+ const existingTokens = await modules.warehousing.findTokens(product.tokenization.contractStandard === 'ERC721'
46
+ ? { contractAddress: product.tokenization.contractAddress }
47
+ : {
48
+ contractAddress: product.tokenization.contractAddress,
49
+ chainTokenId: product.tokenization.tokenId,
50
+ });
51
+ const tokensCreated = existingTokens.reduce((acc, curToken) => {
52
+ return acc + curToken.quantity;
53
+ }, 0);
54
+ if (contractStandard === 'ERC721') {
55
+ // ERC721 is non-fungible, thus every _id unique!
56
+ return new Array(orderPosition?.quantity).fill(null).map((_, i) => ({
57
+ _id,
58
+ chainTokenId: Number(parseInt(MINTER_TOKEN_OFFSET, 10) + tokensCreated + (i + 1)).toString(),
59
+ contractAddress,
60
+ quantity: 1,
61
+ chainId,
62
+ meta,
63
+ }));
64
+ }
65
+ // ERC1155 is fungible, allow the same tokenId
66
+ return [
67
+ {
68
+ _id,
69
+ chainTokenId: tokenId,
70
+ contractAddress,
71
+ quantity: orderPosition?.quantity,
72
+ chainId,
73
+ meta,
74
+ },
75
+ ];
76
+ },
77
+ tokenMetadata: async (chainTokenId) => {
78
+ // if ERC721 -> tokenUri
79
+ // if ERC1155 -> uri
80
+ // -> use the contract to get the correct metadata uri from tokenId
81
+ // depending on the ERC, build the correct metadata json schema
82
+ // https://eips.ethereum.org/EIPS/eip-1155
83
+ // https://eips.ethereum.org/EIPS/eip-721
84
+ const allLanguages = await modules.languages.findLanguages({
85
+ includeInactive: false,
86
+ });
87
+ const [firstMedia] = await modules.products.media.findProductMedias({
88
+ productId: product._id,
89
+ limit: 1,
90
+ });
91
+ const file = firstMedia && (await modules.files.findFile({ fileId: firstMedia.mediaId }));
92
+ const url = file && (await modules.files.getUrl(file, {}));
93
+ const text = await modules.products.texts.findLocalizedText({
94
+ productId: product._id,
95
+ locale: localeContext.normalized,
96
+ });
97
+ const name = `${text.title} #${chainTokenId}`;
98
+ if (product.tokenization.contractStandard === ProductContractStandard.ERC1155) {
99
+ const isDefaultLanguageActive = localeContext.language === systemLocale.language;
100
+ const localization = isDefaultLanguageActive
101
+ ? {
102
+ uri: `${process.env.ROOT_URL}/erc-metadata/${product._id}/{locale}/${product.tokenization.tokenId}.json`,
103
+ default: systemLocale.language,
104
+ locales: allLanguages.map((lang) => lang.isoCode),
105
+ }
106
+ : undefined;
107
+ return {
108
+ name,
109
+ description: text.description,
110
+ image: url,
111
+ properties: product.meta,
112
+ localization,
113
+ };
114
+ }
115
+ return {
116
+ name,
117
+ description: text.description,
118
+ image: url,
119
+ };
120
+ },
121
+ };
122
+ },
123
+ };
124
+ WarehousingDirector.registerAdapter(ETHMinter);
125
+ //# sourceMappingURL=eth-minter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eth-minter.js","sourceRoot":"","sources":["../../src/warehousing/eth-minter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAExE,MAAM,EAAE,mBAAmB,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;AAElD,MAAM,SAAS,GAAwB;IACrC,GAAG,kBAAkB;IAErB,GAAG,EAAE,4CAA4C;IACjD,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,iBAAiB;IACxB,UAAU,EAAE,CAAC;IAEb,oBAAoB,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAEtD,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;QACtB,OAAO,IAAI,KAAK,uBAAuB,CAAC,OAAO,CAAC;IAClD,CAAC;IAED,OAAO,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;QAClC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,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O,CAAC,GAAG,CAAC,QAAQ,iBAAiB,OAAO,CAAC,GAAG,aAAa,OAAO,CAAC,YAAY,CAAC,OAAO,OAAO;4BACxG,OAAO,EAAE,YAAY,CAAC,QAAQ;4BAC9B,OAAO,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;yBAClD;wBACH,CAAC,CAAC,SAAS,CAAC;oBAEd,OAAO;wBACL,IAAI;wBACJ,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,KAAK,EAAE,GAAG;wBACV,UAAU,EAAE,OAAO,CAAC,IAAI;wBACxB,YAAY;qBACb,CAAC;iBACH;gBACD,OAAO;oBACL,IAAI;oBACJ,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,KAAK,EAAE,GAAG;iBACX,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,mBAAmB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unchainedshop/plugins",
3
- "version": "2.0.0-beta4",
3
+ "version": "2.0.0-beta6",
4
4
  "main": "lib/plugins-index.js",
5
5
  "types": "lib/plugins-index.d.ts",
6
6
  "exports": {
@@ -71,28 +71,28 @@
71
71
  },
72
72
  "homepage": "https://github.com/unchainedshop/unchained#readme",
73
73
  "devDependencies": {
74
- "@types/node": "^16.11.68",
75
- "@unchainedshop/api": "^2.0.0-beta4",
74
+ "@types/node": "^16.18.2",
75
+ "@unchainedshop/api": "^2.0.0-beta6",
76
76
  "@unchainedshop/client-oauth2": "^4.3.3",
77
- "@unchainedshop/core-delivery": "^2.0.0-beta4",
78
- "@unchainedshop/core-enrollments": "^2.0.0-beta4",
79
- "@unchainedshop/core-filters": "^2.0.0-beta4",
80
- "@unchainedshop/core-messaging": "^2.0.0-beta4",
81
- "@unchainedshop/core-orders": "^2.0.0-beta4",
82
- "@unchainedshop/core-payment": "^2.0.0-beta4",
83
- "@unchainedshop/core-products": "^2.0.0-beta4",
84
- "@unchainedshop/core-quotations": "^2.0.0-beta4",
85
- "@unchainedshop/core-warehousing": "^2.0.0-beta4",
86
- "@unchainedshop/core-worker": "^2.0.0-beta4",
87
- "@unchainedshop/events": "^2.0.0-beta4",
88
- "@unchainedshop/file-upload": "^2.0.0-beta4",
89
- "@unchainedshop/logger": "^2.0.0-beta4",
90
- "@unchainedshop/types": "^2.0.0-beta4",
91
- "@unchainedshop/utils": "^2.0.0-beta4",
77
+ "@unchainedshop/core-delivery": "^2.0.0-beta6",
78
+ "@unchainedshop/core-enrollments": "^2.0.0-beta6",
79
+ "@unchainedshop/core-filters": "^2.0.0-beta6",
80
+ "@unchainedshop/core-messaging": "^2.0.0-beta6",
81
+ "@unchainedshop/core-orders": "^2.0.0-beta6",
82
+ "@unchainedshop/core-payment": "^2.0.0-beta6",
83
+ "@unchainedshop/core-products": "^2.0.0-beta6",
84
+ "@unchainedshop/core-quotations": "^2.0.0-beta6",
85
+ "@unchainedshop/core-warehousing": "^2.0.0-beta6",
86
+ "@unchainedshop/core-worker": "^2.0.0-beta6",
87
+ "@unchainedshop/events": "^2.0.0-beta6",
88
+ "@unchainedshop/file-upload": "^2.0.0-beta6",
89
+ "@unchainedshop/logger": "^2.0.0-beta6",
90
+ "@unchainedshop/types": "^2.0.0-beta6",
91
+ "@unchainedshop/utils": "^2.0.0-beta6",
92
92
  "bluebird": "^3.7.2",
93
93
  "body-parser": "^1.20.0",
94
94
  "event-iterator": "^2.0.0",
95
- "jest": "^29.2.1",
95
+ "jest": "^29.2.2",
96
96
  "JSONStream": "^1.3.5",
97
97
  "minio": "^7.0.32",
98
98
  "mongodb": "^4.11.0",
@@ -20,7 +20,7 @@ export interface CryptopayModule {
20
20
  currency: string;
21
21
  orderPaymentId: string;
22
22
  }) => Promise<CryptopayTransaction>;
23
- getNextDerivationNumber: (currency: string) => Promise<number>
23
+ getNextDerivationNumber: (currency: string) => Promise<number>;
24
24
  }
25
25
 
26
26
  export const configureCryptopayModule = ({ db }: { db: Db }): CryptopayModule => {
@@ -0,0 +1,155 @@
1
+ import {
2
+ WarehousingDirector,
3
+ WarehousingAdapter,
4
+ WarehousingProviderType,
5
+ } from '@unchainedshop/core-warehousing';
6
+ import { ProductType, ProductContractStandard } from '@unchainedshop/types/products';
7
+ import { IWarehousingAdapter, WarehousingError } from '@unchainedshop/types/warehousing';
8
+ import { generateDbObjectId, systemLocale } from '@unchainedshop/utils';
9
+
10
+ const { MINTER_TOKEN_OFFSET = '0' } = process.env;
11
+
12
+ const ETHMinter: IWarehousingAdapter = {
13
+ ...WarehousingAdapter,
14
+
15
+ key: 'shop.unchained.warehousing.infinite-minter',
16
+ version: '1.0',
17
+ label: 'Infinite Minter',
18
+ orderIndex: 0,
19
+
20
+ initialConfiguration: [{ key: 'chainId', value: '0' }],
21
+
22
+ typeSupported: (type) => {
23
+ return type === WarehousingProviderType.VIRTUAL;
24
+ },
25
+
26
+ actions: (configuration, context) => {
27
+ const { product, orderPosition, token, modules, localeContext } = context;
28
+ return {
29
+ ...WarehousingAdapter.actions(configuration, context),
30
+
31
+ isActive() {
32
+ return product?.type === ProductType.TokenizedProduct;
33
+ },
34
+
35
+ configurationError() {
36
+ return null as any as WarehousingError;
37
+ },
38
+
39
+ stock: async () => {
40
+ const existingTokens = await modules.warehousing.findTokens(
41
+ product.tokenization.contractStandard === 'ERC721'
42
+ ? { contractAddress: product.tokenization.contractAddress }
43
+ : {
44
+ contractAddress: product.tokenization.contractAddress,
45
+ chainTokenId: product.tokenization.tokenId,
46
+ },
47
+ );
48
+ const tokensCreated = existingTokens.reduce((acc, curToken) => {
49
+ return acc + curToken.quantity;
50
+ }, 0);
51
+
52
+ return product?.tokenization?.supply ? product.tokenization.supply - tokensCreated : 0;
53
+ },
54
+
55
+ tokenize: async () => {
56
+ // Upload Image to IPFS
57
+ // Upload Metadata to IPFS
58
+ // Prepare metadata
59
+
60
+ const chainId = configuration.find(({ key }) => key === 'chainId')?.value || undefined;
61
+ const { contractAddress, contractStandard, tokenId } = product?.tokenization || {};
62
+ const _id = generateDbObjectId();
63
+ const meta = { contractStandard };
64
+
65
+ const existingTokens = await modules.warehousing.findTokens(
66
+ product.tokenization.contractStandard === 'ERC721'
67
+ ? { contractAddress: product.tokenization.contractAddress }
68
+ : {
69
+ contractAddress: product.tokenization.contractAddress,
70
+ chainTokenId: product.tokenization.tokenId,
71
+ },
72
+ );
73
+ const tokensCreated = existingTokens.reduce((acc, curToken) => {
74
+ return acc + curToken.quantity;
75
+ }, 0);
76
+
77
+ if (contractStandard === 'ERC721') {
78
+ // ERC721 is non-fungible, thus every _id unique!
79
+ return new Array(orderPosition?.quantity).fill(null).map((_, i) => ({
80
+ _id,
81
+ chainTokenId: Number(parseInt(MINTER_TOKEN_OFFSET, 10) + tokensCreated + (i + 1)).toString(),
82
+ contractAddress,
83
+ quantity: 1,
84
+ chainId,
85
+ meta,
86
+ }));
87
+ }
88
+ // ERC1155 is fungible, allow the same tokenId
89
+ return [
90
+ {
91
+ _id,
92
+ chainTokenId: tokenId,
93
+ contractAddress,
94
+ quantity: orderPosition?.quantity,
95
+ chainId,
96
+ meta,
97
+ },
98
+ ];
99
+ },
100
+
101
+ tokenMetadata: async (chainTokenId) => {
102
+ // if ERC721 -> tokenUri
103
+ // if ERC1155 -> uri
104
+ // -> use the contract to get the correct metadata uri from tokenId
105
+
106
+ // depending on the ERC, build the correct metadata json schema
107
+ // https://eips.ethereum.org/EIPS/eip-1155
108
+ // https://eips.ethereum.org/EIPS/eip-721
109
+
110
+ const allLanguages = await modules.languages.findLanguages({
111
+ includeInactive: false,
112
+ });
113
+
114
+ const [firstMedia] = await modules.products.media.findProductMedias({
115
+ productId: product._id,
116
+ limit: 1,
117
+ });
118
+ const file = firstMedia && (await modules.files.findFile({ fileId: firstMedia.mediaId }));
119
+ const url = file && (await modules.files.getUrl(file, {}));
120
+ const text = await modules.products.texts.findLocalizedText({
121
+ productId: product._id,
122
+ locale: localeContext.normalized,
123
+ });
124
+
125
+ const name = `${text.title} #${chainTokenId}`;
126
+
127
+ if (product.tokenization.contractStandard === ProductContractStandard.ERC1155) {
128
+ const isDefaultLanguageActive = localeContext.language === systemLocale.language;
129
+ const localization = isDefaultLanguageActive
130
+ ? {
131
+ uri: `${process.env.ROOT_URL}/erc-metadata/${product._id}/{locale}/${product.tokenization.tokenId}.json`,
132
+ default: systemLocale.language,
133
+ locales: allLanguages.map((lang) => lang.isoCode),
134
+ }
135
+ : undefined;
136
+
137
+ return {
138
+ name,
139
+ description: text.description,
140
+ image: url,
141
+ properties: product.meta,
142
+ localization,
143
+ };
144
+ }
145
+ return {
146
+ name,
147
+ description: text.description,
148
+ image: url,
149
+ };
150
+ },
151
+ };
152
+ },
153
+ };
154
+
155
+ WarehousingDirector.registerAdapter(ETHMinter);