@bosonprotocol/core-sdk 1.39.1 → 1.40.0-alpha.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.
- package/dist/cjs/accounts/handler.d.ts +25 -1
- package/dist/cjs/accounts/handler.d.ts.map +1 -1
- package/dist/cjs/accounts/handler.js +38 -1
- package/dist/cjs/accounts/handler.js.map +1 -1
- package/dist/cjs/accounts/interface.d.ts +20 -3
- package/dist/cjs/accounts/interface.d.ts.map +1 -1
- package/dist/cjs/accounts/interface.js +29 -3
- package/dist/cjs/accounts/interface.js.map +1 -1
- package/dist/cjs/accounts/mixin.d.ts +12 -0
- package/dist/cjs/accounts/mixin.d.ts.map +1 -1
- package/dist/cjs/accounts/mixin.js +40 -0
- package/dist/cjs/accounts/mixin.js.map +1 -1
- package/dist/cjs/accounts/types.d.ts +4 -0
- package/dist/cjs/accounts/types.d.ts.map +1 -1
- package/dist/cjs/core-sdk.d.ts +2 -1
- package/dist/cjs/core-sdk.d.ts.map +1 -1
- package/dist/cjs/core-sdk.js +3 -1
- package/dist/cjs/core-sdk.js.map +1 -1
- package/dist/cjs/meta-tx/handler.js +3 -3
- package/dist/cjs/meta-tx/handler.js.map +1 -1
- package/dist/cjs/offers/handler.d.ts +13 -1
- package/dist/cjs/offers/handler.d.ts.map +1 -1
- package/dist/cjs/offers/handler.js +19 -1
- package/dist/cjs/offers/handler.js.map +1 -1
- package/dist/cjs/offers/interface.d.ts +10 -1
- package/dist/cjs/offers/interface.d.ts.map +1 -1
- package/dist/cjs/offers/interface.js +32 -15
- package/dist/cjs/offers/interface.js.map +1 -1
- package/dist/cjs/offers/mixin.d.ts +21 -1
- package/dist/cjs/offers/mixin.d.ts.map +1 -1
- package/dist/cjs/offers/mixin.js +42 -6
- package/dist/cjs/offers/mixin.js.map +1 -1
- package/dist/cjs/offers/renderContractualAgreement.d.ts.map +1 -1
- package/dist/cjs/offers/renderContractualAgreement.js +7 -1
- package/dist/cjs/offers/renderContractualAgreement.js.map +1 -1
- package/dist/cjs/offers/types.d.ts +1 -1
- package/dist/cjs/offers/types.d.ts.map +1 -1
- package/dist/cjs/offers/types.js +3 -0
- package/dist/cjs/offers/types.js.map +1 -1
- package/dist/cjs/orchestration/handler.d.ts +5 -4
- package/dist/cjs/orchestration/handler.d.ts.map +1 -1
- package/dist/cjs/orchestration/handler.js +4 -4
- package/dist/cjs/orchestration/handler.js.map +1 -1
- package/dist/cjs/orchestration/interface.d.ts +5 -4
- package/dist/cjs/orchestration/interface.d.ts.map +1 -1
- package/dist/cjs/orchestration/interface.js +22 -15
- package/dist/cjs/orchestration/interface.js.map +1 -1
- package/dist/cjs/orchestration/mixin.d.ts +5 -4
- package/dist/cjs/orchestration/mixin.d.ts.map +1 -1
- package/dist/cjs/orchestration/mixin.js +8 -8
- package/dist/cjs/orchestration/mixin.js.map +1 -1
- package/dist/cjs/protocol-config/handler.d.ts +6 -0
- package/dist/cjs/protocol-config/handler.d.ts.map +1 -0
- package/dist/cjs/protocol-config/handler.js +24 -0
- package/dist/cjs/protocol-config/handler.js.map +1 -0
- package/dist/cjs/protocol-config/index.d.ts +3 -0
- package/dist/cjs/protocol-config/index.d.ts.map +1 -0
- package/dist/cjs/protocol-config/index.js +29 -0
- package/dist/cjs/protocol-config/index.js.map +1 -0
- package/dist/cjs/protocol-config/interface.d.ts +5 -0
- package/dist/cjs/protocol-config/interface.d.ts.map +1 -0
- package/dist/cjs/protocol-config/interface.js +16 -0
- package/dist/cjs/protocol-config/interface.js.map +1 -0
- package/dist/cjs/protocol-config/mixin.d.ts +7 -0
- package/dist/cjs/protocol-config/mixin.d.ts.map +1 -0
- package/dist/cjs/protocol-config/mixin.js +26 -0
- package/dist/cjs/protocol-config/mixin.js.map +1 -0
- package/dist/cjs/subgraph.d.ts +6057 -298
- package/dist/cjs/subgraph.d.ts.map +1 -1
- package/dist/cjs/subgraph.js +143 -16
- package/dist/cjs/subgraph.js.map +1 -1
- package/dist/esm/accounts/handler.d.ts +25 -1
- package/dist/esm/accounts/handler.d.ts.map +1 -1
- package/dist/esm/accounts/handler.js +26 -1
- package/dist/esm/accounts/handler.js.map +1 -1
- package/dist/esm/accounts/interface.d.ts +20 -3
- package/dist/esm/accounts/interface.d.ts.map +1 -1
- package/dist/esm/accounts/interface.js +23 -2
- package/dist/esm/accounts/interface.js.map +1 -1
- package/dist/esm/accounts/mixin.d.ts +12 -0
- package/dist/esm/accounts/mixin.d.ts.map +1 -1
- package/dist/esm/accounts/mixin.js +32 -0
- package/dist/esm/accounts/mixin.js.map +1 -1
- package/dist/esm/accounts/types.d.ts +4 -0
- package/dist/esm/accounts/types.d.ts.map +1 -1
- package/dist/esm/core-sdk.d.ts +2 -1
- package/dist/esm/core-sdk.d.ts.map +1 -1
- package/dist/esm/core-sdk.js +3 -1
- package/dist/esm/core-sdk.js.map +1 -1
- package/dist/esm/meta-tx/handler.js +3 -3
- package/dist/esm/meta-tx/handler.js.map +1 -1
- package/dist/esm/offers/handler.d.ts +13 -1
- package/dist/esm/offers/handler.d.ts.map +1 -1
- package/dist/esm/offers/handler.js +13 -1
- package/dist/esm/offers/handler.js.map +1 -1
- package/dist/esm/offers/interface.d.ts +10 -1
- package/dist/esm/offers/interface.d.ts.map +1 -1
- package/dist/esm/offers/interface.js +35 -15
- package/dist/esm/offers/interface.js.map +1 -1
- package/dist/esm/offers/mixin.d.ts +21 -1
- package/dist/esm/offers/mixin.d.ts.map +1 -1
- package/dist/esm/offers/mixin.js +34 -4
- package/dist/esm/offers/mixin.js.map +1 -1
- package/dist/esm/offers/renderContractualAgreement.d.ts.map +1 -1
- package/dist/esm/offers/renderContractualAgreement.js +11 -2
- package/dist/esm/offers/renderContractualAgreement.js.map +1 -1
- package/dist/esm/offers/types.d.ts +1 -1
- package/dist/esm/offers/types.d.ts.map +1 -1
- package/dist/esm/offers/types.js +1 -1
- package/dist/esm/offers/types.js.map +1 -1
- package/dist/esm/orchestration/handler.d.ts +5 -4
- package/dist/esm/orchestration/handler.d.ts.map +1 -1
- package/dist/esm/orchestration/handler.js +4 -4
- package/dist/esm/orchestration/handler.js.map +1 -1
- package/dist/esm/orchestration/interface.d.ts +5 -4
- package/dist/esm/orchestration/interface.d.ts.map +1 -1
- package/dist/esm/orchestration/interface.js +22 -15
- package/dist/esm/orchestration/interface.js.map +1 -1
- package/dist/esm/orchestration/mixin.d.ts +5 -4
- package/dist/esm/orchestration/mixin.d.ts.map +1 -1
- package/dist/esm/orchestration/mixin.js +8 -8
- package/dist/esm/orchestration/mixin.js.map +1 -1
- package/dist/esm/protocol-config/handler.d.ts +6 -0
- package/dist/esm/protocol-config/handler.d.ts.map +1 -0
- package/dist/esm/protocol-config/handler.js +9 -0
- package/dist/esm/protocol-config/handler.js.map +1 -0
- package/dist/esm/protocol-config/index.d.ts +3 -0
- package/dist/esm/protocol-config/index.d.ts.map +1 -0
- package/dist/esm/protocol-config/index.js +3 -0
- package/dist/esm/protocol-config/index.js.map +1 -0
- package/dist/esm/protocol-config/interface.d.ts +5 -0
- package/dist/esm/protocol-config/interface.d.ts.map +1 -0
- package/dist/esm/protocol-config/interface.js +11 -0
- package/dist/esm/protocol-config/interface.js.map +1 -0
- package/dist/esm/protocol-config/mixin.d.ts +7 -0
- package/dist/esm/protocol-config/mixin.d.ts.map +1 -0
- package/dist/esm/protocol-config/mixin.js +11 -0
- package/dist/esm/protocol-config/mixin.js.map +1 -0
- package/dist/esm/subgraph.d.ts +6057 -298
- package/dist/esm/subgraph.d.ts.map +1 -1
- package/dist/esm/subgraph.js +139 -12
- package/dist/esm/subgraph.js.map +1 -1
- package/package.json +3 -3
- package/src/accounts/handler.ts +57 -2
- package/src/accounts/interface.ts +66 -6
- package/src/accounts/mixin.ts +60 -0
- package/src/accounts/queries.graphql +14 -1
- package/src/accounts/types.ts +5 -0
- package/src/core-sdk.ts +5 -2
- package/src/meta-tx/handler.ts +3 -3
- package/src/offers/handler.ts +29 -2
- package/src/offers/interface.ts +74 -16
- package/src/offers/mixin.ts +56 -11
- package/src/offers/queries.graphql +11 -0
- package/src/offers/renderContractualAgreement.ts +11 -2
- package/src/offers/types.ts +1 -1
- package/src/orchestration/handler.ts +9 -8
- package/src/orchestration/interface.ts +23 -15
- package/src/orchestration/mixin.ts +9 -8
- package/src/protocol-config/handler.ts +16 -0
- package/src/protocol-config/index.ts +2 -0
- package/src/protocol-config/interface.ts +18 -0
- package/src/protocol-config/mixin.ts +15 -0
- package/src/subgraph.ts +5284 -299
|
@@ -155,6 +155,17 @@ fragment BaseOfferFields on Offer {
|
|
|
155
155
|
disputeResolverId
|
|
156
156
|
numberOfCommits
|
|
157
157
|
numberOfRedemptions
|
|
158
|
+
priceType
|
|
159
|
+
royaltyInfos {
|
|
160
|
+
timestamp
|
|
161
|
+
recipients {
|
|
162
|
+
recipient {
|
|
163
|
+
id
|
|
164
|
+
wallet
|
|
165
|
+
}
|
|
166
|
+
bps
|
|
167
|
+
}
|
|
168
|
+
}
|
|
158
169
|
condition {
|
|
159
170
|
...BaseConditionFields
|
|
160
171
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as yup from "yup";
|
|
2
2
|
import { ITokenInfo } from "./../utils/tokenInfoManager";
|
|
3
3
|
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
|
4
|
-
import { utils } from "@bosonprotocol/common";
|
|
4
|
+
import { PriceType, utils } from "@bosonprotocol/common";
|
|
5
5
|
import Mustache from "mustache";
|
|
6
6
|
import { formatUnits } from "@ethersproject/units";
|
|
7
7
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
MetadataType,
|
|
12
12
|
ProductV1MetadataEntity
|
|
13
13
|
} from "../subgraph";
|
|
14
|
+
import { AddressZero } from "@ethersproject/constants";
|
|
14
15
|
|
|
15
16
|
export type AdditionalOfferMetadata = {
|
|
16
17
|
sellerContactMethod: string;
|
|
@@ -178,7 +179,15 @@ function convertExistingOfferData(offerDataSubGraph: OfferFieldsFragment): {
|
|
|
178
179
|
offerDataSubGraph.voucherRedeemableUntilDate,
|
|
179
180
|
disputePeriodDurationInMS: offerDataSubGraph.disputePeriodDuration,
|
|
180
181
|
resolutionPeriodDurationInMS: offerDataSubGraph.resolutionPeriodDuration,
|
|
181
|
-
exchangeToken: offerDataSubGraph.exchangeToken.address
|
|
182
|
+
exchangeToken: offerDataSubGraph.exchangeToken.address,
|
|
183
|
+
feeLimit: offerDataSubGraph.price, // feeLimit is never stored on-chain. By default, set it to offer price
|
|
184
|
+
priceType: PriceType.Static,
|
|
185
|
+
royaltyInfo: [
|
|
186
|
+
{
|
|
187
|
+
recipients: [AddressZero], // AddressZero means Seller's treasury account
|
|
188
|
+
bps: ["0"] // Values should be greater or equal than Seller's minimum royalty amount
|
|
189
|
+
}
|
|
190
|
+
]
|
|
182
191
|
},
|
|
183
192
|
offerMetadata: {
|
|
184
193
|
sellerContactMethod: (
|
package/src/offers/types.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { CreateOfferArgs } from "@bosonprotocol/common";
|
|
1
|
+
export { CreateOfferArgs, PriceType } from "@bosonprotocol/common";
|
|
@@ -21,6 +21,7 @@ import { CreateOfferArgs } from "../offers/types";
|
|
|
21
21
|
import { CreateSellerArgs } from "../accounts/types";
|
|
22
22
|
import { BigNumberish } from "@ethersproject/bignumber";
|
|
23
23
|
import { findCollectionSalt } from "../accounts/handler";
|
|
24
|
+
import { PremintParametersStruct } from "@bosonprotocol/common/src";
|
|
24
25
|
import { storeMetadataItems } from "../metadata/storeMetadataItems";
|
|
25
26
|
|
|
26
27
|
export async function createOfferAndSeller(args: {
|
|
@@ -144,7 +145,7 @@ export async function createSellerAndOfferWithCondition(args: {
|
|
|
144
145
|
|
|
145
146
|
export async function createPremintedOfferAddToGroup(args: {
|
|
146
147
|
offerToCreate: CreateOfferArgs;
|
|
147
|
-
|
|
148
|
+
premintParameters: PremintParametersStruct;
|
|
148
149
|
groupId: BigNumberish;
|
|
149
150
|
contractAddress: string;
|
|
150
151
|
web3Lib: Web3LibAdapter;
|
|
@@ -170,7 +171,7 @@ export async function createPremintedOfferAddToGroup(args: {
|
|
|
170
171
|
to: args.contractAddress,
|
|
171
172
|
data: encodeCreatePremintedOfferAddToGroup(
|
|
172
173
|
args.offerToCreate,
|
|
173
|
-
args.
|
|
174
|
+
args.premintParameters,
|
|
174
175
|
args.groupId
|
|
175
176
|
)
|
|
176
177
|
});
|
|
@@ -178,7 +179,7 @@ export async function createPremintedOfferAddToGroup(args: {
|
|
|
178
179
|
|
|
179
180
|
export async function createPremintedOfferWithCondition(args: {
|
|
180
181
|
offerToCreate: CreateOfferArgs;
|
|
181
|
-
|
|
182
|
+
premintParameters: PremintParametersStruct;
|
|
182
183
|
contractAddress: string;
|
|
183
184
|
web3Lib: Web3LibAdapter;
|
|
184
185
|
metadataStorage?: MetadataStorage;
|
|
@@ -204,7 +205,7 @@ export async function createPremintedOfferWithCondition(args: {
|
|
|
204
205
|
to: args.contractAddress,
|
|
205
206
|
data: encodeCreatePremintedOfferWithCondition(
|
|
206
207
|
args.offerToCreate,
|
|
207
|
-
args.
|
|
208
|
+
args.premintParameters,
|
|
208
209
|
args.condition
|
|
209
210
|
)
|
|
210
211
|
});
|
|
@@ -213,7 +214,7 @@ export async function createPremintedOfferWithCondition(args: {
|
|
|
213
214
|
export async function createSellerAndPremintedOffer(args: {
|
|
214
215
|
sellerToCreate: CreateSellerArgs;
|
|
215
216
|
offerToCreate: CreateOfferArgs;
|
|
216
|
-
|
|
217
|
+
premintParameters: PremintParametersStruct;
|
|
217
218
|
contractAddress: string;
|
|
218
219
|
web3Lib: Web3LibAdapter;
|
|
219
220
|
metadataStorage?: MetadataStorage;
|
|
@@ -249,7 +250,7 @@ export async function createSellerAndPremintedOffer(args: {
|
|
|
249
250
|
args.sellerToCreate,
|
|
250
251
|
collectionSalt,
|
|
251
252
|
args.offerToCreate,
|
|
252
|
-
args.
|
|
253
|
+
args.premintParameters
|
|
253
254
|
)
|
|
254
255
|
});
|
|
255
256
|
}
|
|
@@ -257,7 +258,7 @@ export async function createSellerAndPremintedOffer(args: {
|
|
|
257
258
|
export async function createSellerAndPremintedOfferWithCondition(args: {
|
|
258
259
|
sellerToCreate: CreateSellerArgs;
|
|
259
260
|
offerToCreate: CreateOfferArgs;
|
|
260
|
-
|
|
261
|
+
premintParameters: PremintParametersStruct;
|
|
261
262
|
contractAddress: string;
|
|
262
263
|
web3Lib: Web3LibAdapter;
|
|
263
264
|
metadataStorage?: MetadataStorage;
|
|
@@ -294,7 +295,7 @@ export async function createSellerAndPremintedOfferWithCondition(args: {
|
|
|
294
295
|
args.sellerToCreate,
|
|
295
296
|
collectionSalt,
|
|
296
297
|
args.offerToCreate,
|
|
297
|
-
args.
|
|
298
|
+
args.premintParameters,
|
|
298
299
|
args.condition
|
|
299
300
|
)
|
|
300
301
|
});
|
|
@@ -7,6 +7,7 @@ import { CreateSellerArgs } from "../accounts/types";
|
|
|
7
7
|
import { CreateOfferArgs } from "../offers/types";
|
|
8
8
|
import { BigNumberish } from "@ethersproject/bignumber";
|
|
9
9
|
import { conditionArgsToStructs } from "../groups/interface";
|
|
10
|
+
import { PremintParametersStruct } from "@bosonprotocol/common/src";
|
|
10
11
|
|
|
11
12
|
export const bosonOrchestrationHandlerIface = new Interface(
|
|
12
13
|
abis.IBosonOrchestrationHandlerABI
|
|
@@ -29,7 +30,8 @@ export function encodeCreateSellerAndOffer(
|
|
|
29
30
|
offerArgs[3], // disputeResolverId
|
|
30
31
|
sellerArgs.authTokenStruct,
|
|
31
32
|
sellerArgs.voucherInitValues,
|
|
32
|
-
offerArgs[4] // agentId
|
|
33
|
+
offerArgs[4], // agentId
|
|
34
|
+
offerArgs[5] // feeLimit
|
|
33
35
|
]
|
|
34
36
|
);
|
|
35
37
|
}
|
|
@@ -47,7 +49,8 @@ export function encodeCreateOfferWithCondition(
|
|
|
47
49
|
offerArgs[2], // offerDurations
|
|
48
50
|
offerArgs[3], // disputeResolverId
|
|
49
51
|
conditionArgsToStructs(condition),
|
|
50
|
-
offerArgs[4] // agentId
|
|
52
|
+
offerArgs[4], // agentId
|
|
53
|
+
offerArgs[5] // feeLimit
|
|
51
54
|
]
|
|
52
55
|
);
|
|
53
56
|
}
|
|
@@ -71,14 +74,15 @@ export function encodeCreateSellerAndOfferWithCondition(
|
|
|
71
74
|
conditionArgsToStructs(condition),
|
|
72
75
|
sellerArgs.authTokenStruct,
|
|
73
76
|
sellerArgs.voucherInitValues,
|
|
74
|
-
offerArgs[4] // agentId
|
|
77
|
+
offerArgs[4], // agentId
|
|
78
|
+
offerArgs[5] // feeLimit
|
|
75
79
|
]
|
|
76
80
|
);
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
export function encodeCreatePremintedOfferAddToGroup(
|
|
80
84
|
offer: CreateOfferArgs,
|
|
81
|
-
|
|
85
|
+
premintParameters: PremintParametersStruct,
|
|
82
86
|
groupId: BigNumberish
|
|
83
87
|
) {
|
|
84
88
|
const offerArgs = createOfferArgsToStructs(offer);
|
|
@@ -90,16 +94,17 @@ export function encodeCreatePremintedOfferAddToGroup(
|
|
|
90
94
|
offerArgs[1], // offerDates
|
|
91
95
|
offerArgs[2], // offerDurations
|
|
92
96
|
offerArgs[3], // disputeResolverId
|
|
93
|
-
|
|
97
|
+
premintParameters,
|
|
94
98
|
groupId,
|
|
95
|
-
offerArgs[4] // agentId
|
|
99
|
+
offerArgs[4], // agentId
|
|
100
|
+
offerArgs[5] // feeLimit
|
|
96
101
|
]
|
|
97
102
|
);
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
export function encodeCreatePremintedOfferWithCondition(
|
|
101
106
|
offer: CreateOfferArgs,
|
|
102
|
-
|
|
107
|
+
premintParameters: PremintParametersStruct,
|
|
103
108
|
condition: ConditionStruct
|
|
104
109
|
) {
|
|
105
110
|
const offerArgs = createOfferArgsToStructs(offer);
|
|
@@ -110,9 +115,10 @@ export function encodeCreatePremintedOfferWithCondition(
|
|
|
110
115
|
offerArgs[1], // offerDates
|
|
111
116
|
offerArgs[2], // offerDurations
|
|
112
117
|
offerArgs[3], // disputeResolverId
|
|
113
|
-
|
|
118
|
+
premintParameters,
|
|
114
119
|
conditionArgsToStructs(condition),
|
|
115
|
-
offerArgs[4] // agentId
|
|
120
|
+
offerArgs[4], // agentId
|
|
121
|
+
offerArgs[5] // feeLimit
|
|
116
122
|
]
|
|
117
123
|
);
|
|
118
124
|
}
|
|
@@ -121,7 +127,7 @@ export function encodeCreateSellerAndPremintedOffer(
|
|
|
121
127
|
seller: CreateSellerArgs,
|
|
122
128
|
collectionSalt: string,
|
|
123
129
|
offer: CreateOfferArgs,
|
|
124
|
-
|
|
130
|
+
premintParameters: PremintParametersStruct
|
|
125
131
|
) {
|
|
126
132
|
const sellerArgs = createSellerArgsToStruct(seller, collectionSalt);
|
|
127
133
|
const offerArgs = createOfferArgsToStructs(offer);
|
|
@@ -133,10 +139,11 @@ export function encodeCreateSellerAndPremintedOffer(
|
|
|
133
139
|
offerArgs[1], // offerDates
|
|
134
140
|
offerArgs[2], // offerDurations
|
|
135
141
|
offerArgs[3], // disputeResolverId
|
|
136
|
-
|
|
142
|
+
premintParameters,
|
|
137
143
|
sellerArgs.authTokenStruct,
|
|
138
144
|
sellerArgs.voucherInitValues,
|
|
139
|
-
offerArgs[4] // agentId
|
|
145
|
+
offerArgs[4], // agentId
|
|
146
|
+
offerArgs[5] // feeLimit
|
|
140
147
|
]
|
|
141
148
|
);
|
|
142
149
|
}
|
|
@@ -145,7 +152,7 @@ export function encodeCreateSellerAndPremintedOfferWithCondition(
|
|
|
145
152
|
seller: CreateSellerArgs,
|
|
146
153
|
collectionSalt: string,
|
|
147
154
|
offer: CreateOfferArgs,
|
|
148
|
-
|
|
155
|
+
premintParameters: PremintParametersStruct,
|
|
149
156
|
condition: ConditionStruct
|
|
150
157
|
) {
|
|
151
158
|
const sellerArgs = createSellerArgsToStruct(seller, collectionSalt);
|
|
@@ -158,11 +165,12 @@ export function encodeCreateSellerAndPremintedOfferWithCondition(
|
|
|
158
165
|
offerArgs[1], // offerDates
|
|
159
166
|
offerArgs[2], // offerDurations
|
|
160
167
|
offerArgs[3], // disputeResolverId
|
|
161
|
-
|
|
168
|
+
premintParameters,
|
|
162
169
|
conditionArgsToStructs(condition),
|
|
163
170
|
sellerArgs.authTokenStruct,
|
|
164
171
|
sellerArgs.voucherInitValues,
|
|
165
|
-
offerArgs[4] // agentId
|
|
172
|
+
offerArgs[4], // agentId
|
|
173
|
+
offerArgs[5] // feeLimit
|
|
166
174
|
]
|
|
167
175
|
);
|
|
168
176
|
}
|
|
@@ -3,6 +3,7 @@ import { BigNumberish } from "@ethersproject/bignumber";
|
|
|
3
3
|
import { handler } from ".";
|
|
4
4
|
import { offers, accounts } from "..";
|
|
5
5
|
import { BaseCoreSDK } from "./../mixins/base-core-sdk";
|
|
6
|
+
import { PremintParametersStruct } from "@bosonprotocol/common/src";
|
|
6
7
|
|
|
7
8
|
export class OrchestrationMixin extends BaseCoreSDK {
|
|
8
9
|
/**
|
|
@@ -66,7 +67,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
66
67
|
*/
|
|
67
68
|
public async createPremintedOfferAddToGroup(
|
|
68
69
|
offerToCreate: offers.CreateOfferArgs,
|
|
69
|
-
|
|
70
|
+
premintParameters: PremintParametersStruct,
|
|
70
71
|
groupId: BigNumberish,
|
|
71
72
|
overrides: Partial<{
|
|
72
73
|
contractAddress: string;
|
|
@@ -74,7 +75,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
74
75
|
): Promise<TransactionResponse> {
|
|
75
76
|
return handler.createPremintedOfferAddToGroup({
|
|
76
77
|
offerToCreate,
|
|
77
|
-
|
|
78
|
+
premintParameters,
|
|
78
79
|
groupId,
|
|
79
80
|
contractAddress: overrides.contractAddress || this._protocolDiamond,
|
|
80
81
|
web3Lib: this._web3Lib,
|
|
@@ -95,7 +96,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
95
96
|
public async createSellerAndPremintedOffer(
|
|
96
97
|
sellerToCreate: accounts.CreateSellerArgs,
|
|
97
98
|
offerToCreate: offers.CreateOfferArgs,
|
|
98
|
-
|
|
99
|
+
premintParameters: PremintParametersStruct,
|
|
99
100
|
overrides: Partial<{
|
|
100
101
|
contractAddress: string;
|
|
101
102
|
}> = {}
|
|
@@ -103,7 +104,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
103
104
|
return handler.createSellerAndPremintedOffer({
|
|
104
105
|
sellerToCreate,
|
|
105
106
|
offerToCreate,
|
|
106
|
-
|
|
107
|
+
premintParameters,
|
|
107
108
|
contractAddress: overrides.contractAddress || this._protocolDiamond,
|
|
108
109
|
web3Lib: this._web3Lib,
|
|
109
110
|
metadataStorage: this._metadataStorage,
|
|
@@ -121,7 +122,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
121
122
|
*/
|
|
122
123
|
public async createPremintedOfferWithCondition(
|
|
123
124
|
offerToCreate: offers.CreateOfferArgs,
|
|
124
|
-
|
|
125
|
+
premintParameters: PremintParametersStruct,
|
|
125
126
|
condition: ConditionStruct,
|
|
126
127
|
overrides: Partial<{
|
|
127
128
|
contractAddress: string;
|
|
@@ -129,7 +130,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
129
130
|
): Promise<TransactionResponse> {
|
|
130
131
|
return handler.createPremintedOfferWithCondition({
|
|
131
132
|
offerToCreate,
|
|
132
|
-
|
|
133
|
+
premintParameters,
|
|
133
134
|
condition,
|
|
134
135
|
contractAddress: overrides.contractAddress || this._protocolDiamond,
|
|
135
136
|
web3Lib: this._web3Lib,
|
|
@@ -151,7 +152,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
151
152
|
public async createSellerAndPremintedOfferWithCondition(
|
|
152
153
|
sellerToCreate: accounts.CreateSellerArgs,
|
|
153
154
|
offerToCreate: offers.CreateOfferArgs,
|
|
154
|
-
|
|
155
|
+
premintParameters: PremintParametersStruct,
|
|
155
156
|
condition: ConditionStruct,
|
|
156
157
|
overrides: Partial<{
|
|
157
158
|
contractAddress: string;
|
|
@@ -160,7 +161,7 @@ export class OrchestrationMixin extends BaseCoreSDK {
|
|
|
160
161
|
return handler.createSellerAndPremintedOfferWithCondition({
|
|
161
162
|
sellerToCreate,
|
|
162
163
|
offerToCreate,
|
|
163
|
-
|
|
164
|
+
premintParameters,
|
|
164
165
|
contractAddress: overrides.contractAddress || this._protocolDiamond,
|
|
165
166
|
web3Lib: this._web3Lib,
|
|
166
167
|
metadataStorage: this._metadataStorage,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Web3LibAdapter } from "@bosonprotocol/common";
|
|
2
|
+
import {
|
|
3
|
+
encodeGetMaxRoyaltyPercentage,
|
|
4
|
+
decodeGetMaxRoyaltyPercentage
|
|
5
|
+
} from "./interface";
|
|
6
|
+
|
|
7
|
+
export async function getMaxRoyaltyPercentage(args: {
|
|
8
|
+
contractAddress: string;
|
|
9
|
+
web3Lib: Web3LibAdapter;
|
|
10
|
+
}): Promise<number> {
|
|
11
|
+
const result = await args.web3Lib.call({
|
|
12
|
+
to: args.contractAddress,
|
|
13
|
+
data: encodeGetMaxRoyaltyPercentage()
|
|
14
|
+
});
|
|
15
|
+
return decodeGetMaxRoyaltyPercentage(result);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { abis } from "@bosonprotocol/common";
|
|
2
|
+
import { Interface } from "@ethersproject/abi";
|
|
3
|
+
|
|
4
|
+
export const bosonConfigHandlerIface = new Interface(
|
|
5
|
+
abis.IBosonConfigHandlerABI
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export function encodeGetMaxRoyaltyPercentage(): string {
|
|
9
|
+
return bosonConfigHandlerIface.encodeFunctionData("getMaxRoyaltyPercentage");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function decodeGetMaxRoyaltyPercentage(result: string): number {
|
|
13
|
+
const [maxRoyaltyPercentage] = bosonConfigHandlerIface.decodeFunctionResult(
|
|
14
|
+
"getMaxRoyaltyPercentage",
|
|
15
|
+
result
|
|
16
|
+
);
|
|
17
|
+
return Number(maxRoyaltyPercentage);
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCoreSDK } from "../mixins/base-core-sdk";
|
|
2
|
+
import { handler } from ".";
|
|
3
|
+
|
|
4
|
+
export class ProtocolConfigMixin extends BaseCoreSDK {
|
|
5
|
+
public async getMaxRoyaltyPercentage(
|
|
6
|
+
overrides: Partial<{
|
|
7
|
+
contractAddress: string;
|
|
8
|
+
}> = {}
|
|
9
|
+
): Promise<number> {
|
|
10
|
+
return handler.getMaxRoyaltyPercentage({
|
|
11
|
+
contractAddress: overrides.contractAddress || this._protocolDiamond,
|
|
12
|
+
web3Lib: this._web3Lib
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|