@bosonprotocol/core-sdk 1.24.0 → 1.24.1-alpha.0
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 +0 -5
- package/dist/cjs/accounts/handler.d.ts.map +1 -1
- package/dist/cjs/accounts/handler.js +1 -10
- package/dist/cjs/accounts/handler.js.map +1 -1
- package/dist/cjs/accounts/interface.d.ts +0 -1
- package/dist/cjs/accounts/interface.d.ts.map +1 -1
- package/dist/cjs/accounts/interface.js +1 -5
- package/dist/cjs/accounts/interface.js.map +1 -1
- package/dist/cjs/accounts/mixin.d.ts +0 -7
- package/dist/cjs/accounts/mixin.d.ts.map +1 -1
- package/dist/cjs/accounts/mixin.js +0 -15
- package/dist/cjs/accounts/mixin.js.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/erc721/handler.d.ts.map +1 -1
- package/dist/cjs/erc721/handler.js +2 -1
- package/dist/cjs/erc721/handler.js.map +1 -1
- package/dist/cjs/meta-tx/handler.d.ts +8 -0
- package/dist/cjs/meta-tx/handler.d.ts.map +1 -1
- package/dist/cjs/meta-tx/handler.js +14 -1
- package/dist/cjs/meta-tx/handler.js.map +1 -1
- package/dist/cjs/meta-tx/mixin.d.ts +2 -0
- package/dist/cjs/meta-tx/mixin.d.ts.map +1 -1
- package/dist/cjs/meta-tx/mixin.js +12 -0
- package/dist/cjs/meta-tx/mixin.js.map +1 -1
- package/dist/cjs/offers/handler.d.ts +7 -0
- package/dist/cjs/offers/handler.d.ts.map +1 -1
- package/dist/cjs/offers/handler.js +22 -1
- package/dist/cjs/offers/handler.js.map +1 -1
- package/dist/cjs/offers/interface.d.ts +1 -0
- package/dist/cjs/offers/interface.d.ts.map +1 -1
- package/dist/cjs/offers/interface.js +8 -1
- package/dist/cjs/offers/interface.js.map +1 -1
- package/dist/cjs/offers/mixin.d.ts +9 -0
- package/dist/cjs/offers/mixin.d.ts.map +1 -1
- package/dist/cjs/offers/mixin.js +17 -0
- package/dist/cjs/offers/mixin.js.map +1 -1
- package/dist/cjs/orchestration/handler.d.ts +45 -0
- package/dist/cjs/orchestration/handler.d.ts.map +1 -1
- package/dist/cjs/orchestration/handler.js +78 -1
- package/dist/cjs/orchestration/handler.js.map +1 -1
- package/dist/cjs/orchestration/interface.d.ts +6 -0
- package/dist/cjs/orchestration/interface.d.ts.map +1 -1
- package/dist/cjs/orchestration/interface.js +64 -1
- package/dist/cjs/orchestration/interface.js.map +1 -1
- package/dist/cjs/orchestration/mixin.d.ts +57 -0
- package/dist/cjs/orchestration/mixin.d.ts.map +1 -1
- package/dist/cjs/orchestration/mixin.js +105 -0
- package/dist/cjs/orchestration/mixin.js.map +1 -1
- package/dist/cjs/voucher/handler.d.ts +32 -0
- package/dist/cjs/voucher/handler.d.ts.map +1 -0
- package/dist/cjs/voucher/handler.js +69 -0
- package/dist/cjs/voucher/handler.js.map +1 -0
- package/dist/cjs/voucher/index.d.ts +3 -0
- package/dist/cjs/voucher/index.d.ts.map +1 -0
- package/dist/cjs/voucher/index.js +29 -0
- package/dist/cjs/voucher/index.js.map +1 -0
- package/dist/cjs/voucher/interface.d.ts +11 -0
- package/dist/cjs/voucher/interface.d.ts.map +1 -0
- package/dist/cjs/voucher/interface.js +43 -0
- package/dist/cjs/voucher/interface.js.map +1 -0
- package/dist/cjs/voucher/mixin.d.ts +53 -0
- package/dist/cjs/voucher/mixin.d.ts.map +1 -0
- package/dist/cjs/voucher/mixin.js +107 -0
- package/dist/cjs/voucher/mixin.js.map +1 -0
- package/dist/esm/accounts/handler.d.ts +0 -5
- package/dist/esm/accounts/handler.d.ts.map +1 -1
- package/dist/esm/accounts/handler.js +1 -7
- package/dist/esm/accounts/handler.js.map +1 -1
- package/dist/esm/accounts/interface.d.ts +0 -1
- package/dist/esm/accounts/interface.d.ts.map +1 -1
- package/dist/esm/accounts/interface.js +0 -3
- package/dist/esm/accounts/interface.js.map +1 -1
- package/dist/esm/accounts/mixin.d.ts +0 -7
- package/dist/esm/accounts/mixin.d.ts.map +1 -1
- package/dist/esm/accounts/mixin.js +0 -13
- package/dist/esm/accounts/mixin.js.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/erc721/handler.d.ts.map +1 -1
- package/dist/esm/erc721/handler.js +2 -1
- package/dist/esm/erc721/handler.js.map +1 -1
- package/dist/esm/meta-tx/handler.d.ts +8 -0
- package/dist/esm/meta-tx/handler.d.ts.map +1 -1
- package/dist/esm/meta-tx/handler.js +16 -1
- package/dist/esm/meta-tx/handler.js.map +1 -1
- package/dist/esm/meta-tx/mixin.d.ts +2 -0
- package/dist/esm/meta-tx/mixin.d.ts.map +1 -1
- package/dist/esm/meta-tx/mixin.js +18 -0
- package/dist/esm/meta-tx/mixin.js.map +1 -1
- package/dist/esm/offers/handler.d.ts +7 -0
- package/dist/esm/offers/handler.d.ts.map +1 -1
- package/dist/esm/offers/handler.js +19 -1
- package/dist/esm/offers/handler.js.map +1 -1
- package/dist/esm/offers/interface.d.ts +1 -0
- package/dist/esm/offers/interface.d.ts.map +1 -1
- package/dist/esm/offers/interface.js +6 -0
- package/dist/esm/offers/interface.js.map +1 -1
- package/dist/esm/offers/mixin.d.ts +9 -0
- package/dist/esm/offers/mixin.d.ts.map +1 -1
- package/dist/esm/offers/mixin.js +15 -0
- package/dist/esm/offers/mixin.js.map +1 -1
- package/dist/esm/orchestration/handler.d.ts +45 -0
- package/dist/esm/orchestration/handler.d.ts.map +1 -1
- package/dist/esm/orchestration/handler.js +63 -1
- package/dist/esm/orchestration/handler.js.map +1 -1
- package/dist/esm/orchestration/interface.d.ts +6 -0
- package/dist/esm/orchestration/interface.d.ts.map +1 -1
- package/dist/esm/orchestration/interface.js +58 -0
- package/dist/esm/orchestration/interface.js.map +1 -1
- package/dist/esm/orchestration/mixin.d.ts +57 -0
- package/dist/esm/orchestration/mixin.d.ts.map +1 -1
- package/dist/esm/orchestration/mixin.js +95 -0
- package/dist/esm/orchestration/mixin.js.map +1 -1
- package/dist/esm/voucher/handler.d.ts +32 -0
- package/dist/esm/voucher/handler.d.ts.map +1 -0
- package/dist/esm/voucher/handler.js +42 -0
- package/dist/esm/voucher/handler.js.map +1 -0
- package/dist/esm/voucher/index.d.ts +3 -0
- package/dist/esm/voucher/index.d.ts.map +1 -0
- package/dist/esm/voucher/index.js +3 -0
- package/dist/esm/voucher/index.js.map +1 -0
- package/dist/esm/voucher/interface.d.ts +11 -0
- package/dist/esm/voucher/interface.d.ts.map +1 -0
- package/dist/esm/voucher/interface.js +33 -0
- package/dist/esm/voucher/interface.js.map +1 -0
- package/dist/esm/voucher/mixin.d.ts +53 -0
- package/dist/esm/voucher/mixin.d.ts.map +1 -0
- package/dist/esm/voucher/mixin.js +84 -0
- package/dist/esm/voucher/mixin.js.map +1 -0
- package/package.json +3 -3
- package/src/accounts/handler.ts +0 -12
- package/src/accounts/interface.ts +0 -7
- package/src/accounts/mixin.ts +0 -16
- package/src/core-sdk.ts +5 -2
- package/src/erc721/handler.ts +3 -1
- package/src/meta-tx/handler.ts +29 -1
- package/src/meta-tx/mixin.ts +33 -0
- package/src/offers/handler.ts +42 -1
- package/src/offers/interface.ts +10 -0
- package/src/offers/mixin.ts +22 -0
- package/src/orchestration/handler.ts +138 -1
- package/src/orchestration/interface.ts +97 -0
- package/src/orchestration/mixin.ts +135 -0
- package/src/voucher/handler.ts +80 -0
- package/src/voucher/index.ts +2 -0
- package/src/voucher/interface.ts +45 -0
- package/src/voucher/mixin.ts +126 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { abis } from "@bosonprotocol/common";
|
|
2
|
+
import { Interface } from "@ethersproject/abi";
|
|
3
|
+
export const bosonVoucherIface = new Interface(abis.IBosonVoucherABI);
|
|
4
|
+
export function encodeBurnPremintedVouchers(offerId) {
|
|
5
|
+
return bosonVoucherIface.encodeFunctionData("burnPremintedVouchers", [
|
|
6
|
+
offerId
|
|
7
|
+
]);
|
|
8
|
+
}
|
|
9
|
+
export function encodeGetAvailablePreMints(offerId) {
|
|
10
|
+
return bosonVoucherIface.encodeFunctionData("getAvailablePreMints", [
|
|
11
|
+
offerId
|
|
12
|
+
]);
|
|
13
|
+
}
|
|
14
|
+
export function decodeGetAvailablePreMints(result) {
|
|
15
|
+
return bosonVoucherIface.decodeFunctionResult("getAvailablePreMints", result);
|
|
16
|
+
}
|
|
17
|
+
export function encodeGetRangeByOfferId(offerId) {
|
|
18
|
+
return bosonVoucherIface.encodeFunctionData("getRangeByOfferId", [offerId]);
|
|
19
|
+
}
|
|
20
|
+
export function decodeGetRangeByOfferId(result) {
|
|
21
|
+
return bosonVoucherIface.decodeFunctionResult("getRangeByOfferId", result);
|
|
22
|
+
}
|
|
23
|
+
export function encodePreMint(offerId, amount) {
|
|
24
|
+
return bosonVoucherIface.encodeFunctionData("preMint", [offerId, amount]);
|
|
25
|
+
}
|
|
26
|
+
export function encodeTransferFrom(from, to, tokenId) {
|
|
27
|
+
return bosonVoucherIface.encodeFunctionData("transferFrom", [
|
|
28
|
+
from,
|
|
29
|
+
to,
|
|
30
|
+
tokenId
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/voucher/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAEtE,MAAM,UAAU,2BAA2B,CAAC,OAAqB;IAC/D,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,uBAAuB,EAAE;QACnE,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,OAAqB;IAC9D,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,sBAAsB,EAAE;QAClE,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAqB;IAC3D,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAqB,EAAE,MAAoB;IACvE,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,IAAkB,EAClB,EAAgB,EAChB,OAAqB;IAErB,OAAO,iBAAiB,CAAC,kBAAkB,CAAC,cAAc,EAAE;QAC1D,IAAI;QACJ,EAAE;QACF,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { TransactionResponse } from "@bosonprotocol/common";
|
|
2
|
+
import { Range } from "@bosonprotocol/common/src/types";
|
|
3
|
+
import { BigNumberish } from "@ethersproject/bignumber";
|
|
4
|
+
import { BaseCoreSDK } from "./../mixins/base-core-sdk";
|
|
5
|
+
export declare class VoucherMixin extends BaseCoreSDK {
|
|
6
|
+
/**
|
|
7
|
+
* Burns preminted vouchers from an offer
|
|
8
|
+
* @param offerId - Offer ID
|
|
9
|
+
* @param overrides - Optional overrides.
|
|
10
|
+
* @returns Transaction response.
|
|
11
|
+
*/
|
|
12
|
+
burnPremintedVouchers(offerId: BigNumberish, overrides?: Partial<{
|
|
13
|
+
contractAddress: string;
|
|
14
|
+
}>): Promise<TransactionResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the number of vouchers available to be pre-minted for an offer.
|
|
17
|
+
* @param offerId - Offer ID
|
|
18
|
+
* @param overrides - Optional overrides.
|
|
19
|
+
* @returns Transaction response.
|
|
20
|
+
*/
|
|
21
|
+
getAvailablePreMints(offerId: BigNumberish, overrides?: Partial<{
|
|
22
|
+
contractAddress: string;
|
|
23
|
+
}>): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the range for an offer.
|
|
26
|
+
* @param offerId - Offer ID
|
|
27
|
+
* @param overrides - Optional overrides.
|
|
28
|
+
* @returns Transaction response.
|
|
29
|
+
*/
|
|
30
|
+
getRangeByOfferId(offerId: BigNumberish, overrides?: Partial<{
|
|
31
|
+
contractAddress: string;
|
|
32
|
+
}>): Promise<Range>;
|
|
33
|
+
/**
|
|
34
|
+
* Pre-mints all or part of an offer's reserved vouchers.
|
|
35
|
+
* @param offerId - Offer ID
|
|
36
|
+
* @param overrides - Optional overrides.
|
|
37
|
+
* @returns Transaction response.
|
|
38
|
+
*/
|
|
39
|
+
preMint(offerId: BigNumberish, amount: BigNumberish, overrides?: Partial<{
|
|
40
|
+
contractAddress: string;
|
|
41
|
+
}>): Promise<TransactionResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Pre-mints all or part of an offer's reserved vouchers.
|
|
44
|
+
* @param offerId - Offer ID
|
|
45
|
+
* @param overrides - Optional overrides.
|
|
46
|
+
* @returns Transaction response.
|
|
47
|
+
*/
|
|
48
|
+
transferFrom(offerId: BigNumberish, to: BigNumberish, tokenId: BigNumberish, overrides?: Partial<{
|
|
49
|
+
owner: BigNumberish;
|
|
50
|
+
contractAddress: string;
|
|
51
|
+
}>): Promise<TransactionResponse>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=mixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../../src/voucher/mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;OAKG;IACU,qBAAqB,CAChC,OAAO,EAAE,YAAY,EACrB,SAAS,GAAE,OAAO,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAM,GACN,OAAO,CAAC,mBAAmB,CAAC;IAW/B;;;;;OAKG;IACU,oBAAoB,CAC/B,OAAO,EAAE,YAAY,EACrB,SAAS,GAAE,OAAO,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAM,GACN,OAAO,CAAC,MAAM,CAAC;IAWlB;;;;;OAKG;IACU,iBAAiB,CAC5B,OAAO,EAAE,YAAY,EACrB,SAAS,GAAE,OAAO,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAM,GACN,OAAO,CAAC,KAAK,CAAC;IAWjB;;;;;OAKG;IACU,OAAO,CAClB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,YAAY,EACpB,SAAS,GAAE,OAAO,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAM,GACN,OAAO,CAAC,mBAAmB,CAAC;IAY/B;;;;;OAKG;IACU,YAAY,CACvB,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE,YAAY,EAChB,OAAO,EAAE,YAAY,EACrB,SAAS,GAAE,OAAO,CAAC;QACjB,KAAK,EAAE,YAAY,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAM,GACN,OAAO,CAAC,mBAAmB,CAAC;CAahC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { handler } from ".";
|
|
2
|
+
import { getOfferById } from "../offers/subgraph";
|
|
3
|
+
import { BaseCoreSDK } from "./../mixins/base-core-sdk";
|
|
4
|
+
export class VoucherMixin extends BaseCoreSDK {
|
|
5
|
+
/**
|
|
6
|
+
* Burns preminted vouchers from an offer
|
|
7
|
+
* @param offerId - Offer ID
|
|
8
|
+
* @param overrides - Optional overrides.
|
|
9
|
+
* @returns Transaction response.
|
|
10
|
+
*/
|
|
11
|
+
async burnPremintedVouchers(offerId, overrides = {}) {
|
|
12
|
+
const offerFromSubgraph = await getOfferById(this._subgraphUrl, offerId);
|
|
13
|
+
return handler.burnPremintedVouchers({
|
|
14
|
+
offerId,
|
|
15
|
+
contractAddress: overrides.contractAddress ||
|
|
16
|
+
offerFromSubgraph.seller.voucherCloneAddress,
|
|
17
|
+
web3Lib: this._web3Lib
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the number of vouchers available to be pre-minted for an offer.
|
|
22
|
+
* @param offerId - Offer ID
|
|
23
|
+
* @param overrides - Optional overrides.
|
|
24
|
+
* @returns Transaction response.
|
|
25
|
+
*/
|
|
26
|
+
async getAvailablePreMints(offerId, overrides = {}) {
|
|
27
|
+
const offerFromSubgraph = await getOfferById(this._subgraphUrl, offerId);
|
|
28
|
+
return handler.getAvailablePreMints({
|
|
29
|
+
offerId,
|
|
30
|
+
contractAddress: overrides.contractAddress ||
|
|
31
|
+
offerFromSubgraph.seller.voucherCloneAddress,
|
|
32
|
+
web3Lib: this._web3Lib
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the range for an offer.
|
|
37
|
+
* @param offerId - Offer ID
|
|
38
|
+
* @param overrides - Optional overrides.
|
|
39
|
+
* @returns Transaction response.
|
|
40
|
+
*/
|
|
41
|
+
async getRangeByOfferId(offerId, overrides = {}) {
|
|
42
|
+
const offerFromSubgraph = await getOfferById(this._subgraphUrl, offerId);
|
|
43
|
+
return handler.getRangeByOfferId({
|
|
44
|
+
offerId,
|
|
45
|
+
contractAddress: overrides.contractAddress ||
|
|
46
|
+
offerFromSubgraph.seller.voucherCloneAddress,
|
|
47
|
+
web3Lib: this._web3Lib
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Pre-mints all or part of an offer's reserved vouchers.
|
|
52
|
+
* @param offerId - Offer ID
|
|
53
|
+
* @param overrides - Optional overrides.
|
|
54
|
+
* @returns Transaction response.
|
|
55
|
+
*/
|
|
56
|
+
async preMint(offerId, amount, overrides = {}) {
|
|
57
|
+
const offerFromSubgraph = await getOfferById(this._subgraphUrl, offerId);
|
|
58
|
+
return handler.preMint({
|
|
59
|
+
offerId,
|
|
60
|
+
amount,
|
|
61
|
+
contractAddress: overrides.contractAddress ||
|
|
62
|
+
offerFromSubgraph.seller.voucherCloneAddress,
|
|
63
|
+
web3Lib: this._web3Lib
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Pre-mints all or part of an offer's reserved vouchers.
|
|
68
|
+
* @param offerId - Offer ID
|
|
69
|
+
* @param overrides - Optional overrides.
|
|
70
|
+
* @returns Transaction response.
|
|
71
|
+
*/
|
|
72
|
+
async transferFrom(offerId, to, tokenId, overrides = {}) {
|
|
73
|
+
const offerFromSubgraph = await getOfferById(this._subgraphUrl, offerId);
|
|
74
|
+
return handler.transferFrom({
|
|
75
|
+
from: overrides.owner || (await this._web3Lib.getSignerAddress()),
|
|
76
|
+
to,
|
|
77
|
+
tokenId,
|
|
78
|
+
contractAddress: overrides.contractAddress ||
|
|
79
|
+
offerFromSubgraph.seller.voucherCloneAddress,
|
|
80
|
+
web3Lib: this._web3Lib
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=mixin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixin.js","sourceRoot":"","sources":["../../../src/voucher/mixin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CAChC,OAAqB,EACrB,YAEK,EAAE;QAEP,MAAM,iBAAiB,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,qBAAqB,CAAC;YACnC,OAAO;YACP,eAAe,EACb,SAAS,CAAC,eAAe;gBACzB,iBAAiB,CAAC,MAAM,CAAC,mBAAmB;YAC9C,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,oBAAoB,CAC/B,OAAqB,EACrB,YAEK,EAAE;QAEP,MAAM,iBAAiB,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,oBAAoB,CAAC;YAClC,OAAO;YACP,eAAe,EACb,SAAS,CAAC,eAAe;gBACzB,iBAAiB,CAAC,MAAM,CAAC,mBAAmB;YAC9C,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB,CAC5B,OAAqB,EACrB,YAEK,EAAE;QAEP,MAAM,iBAAiB,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAC/B,OAAO;YACP,eAAe,EACb,SAAS,CAAC,eAAe;gBACzB,iBAAiB,CAAC,MAAM,CAAC,mBAAmB;YAC9C,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,OAAO,CAClB,OAAqB,EACrB,MAAoB,EACpB,YAEK,EAAE;QAEP,MAAM,iBAAiB,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,OAAO;YACP,MAAM;YACN,eAAe,EACb,SAAS,CAAC,eAAe;gBACzB,iBAAiB,CAAC,MAAM,CAAC,mBAAmB;YAC9C,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,YAAY,CACvB,OAAqB,EACrB,EAAgB,EAChB,OAAqB,EACrB,YAGK,EAAE;QAEP,MAAM,iBAAiB,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAEzE,OAAO,OAAO,CAAC,YAAY,CAAC;YAC1B,IAAI,EAAE,SAAS,CAAC,KAAK,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YACjE,EAAE;YACF,OAAO;YACP,eAAe,EACb,SAAS,CAAC,eAAe;gBACzB,iBAAiB,CAAC,MAAM,CAAC,mBAAmB;YAC9C,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bosonprotocol/core-sdk",
|
|
3
|
-
"version": "1.24.0",
|
|
3
|
+
"version": "1.24.1-alpha.0",
|
|
4
4
|
"description": "Facilitates interaction with the contracts and subgraphs of the Boson Protocol",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@bosonprotocol/common": "^1.20.
|
|
36
|
+
"@bosonprotocol/common": "^1.20.3-alpha.0",
|
|
37
37
|
"@ethersproject/abi": "^5.5.0",
|
|
38
38
|
"@ethersproject/address": "^5.5.0",
|
|
39
39
|
"@ethersproject/bignumber": "^5.5.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"ts-jest": "^27.1.3",
|
|
55
55
|
"typescript": "^4.5.5"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "4856ecdf22d04e8521e5afa00b3478ca2b0b2540"
|
|
58
58
|
}
|
package/src/accounts/handler.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
encodeCreateSeller,
|
|
10
10
|
encodeUpdateSeller,
|
|
11
11
|
encodeCreateDisputeResolver,
|
|
12
|
-
encodeActivateDisputeResolver,
|
|
13
12
|
encodeAddFeesToDisputeResolver,
|
|
14
13
|
encodeAddSellersToAllowList,
|
|
15
14
|
encodeRemoveFeesFromDisputeResolver,
|
|
@@ -76,17 +75,6 @@ export async function createDisputeResolver(args: {
|
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
export async function activateDisputeResolver(args: {
|
|
80
|
-
disputeResolverId: BigNumberish;
|
|
81
|
-
contractAddress: string;
|
|
82
|
-
web3Lib: Web3LibAdapter;
|
|
83
|
-
}) {
|
|
84
|
-
return args.web3Lib.sendTransaction({
|
|
85
|
-
to: args.contractAddress,
|
|
86
|
-
data: encodeActivateDisputeResolver(args.disputeResolverId)
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
78
|
export async function addFeesToDisputeResolver(args: {
|
|
91
79
|
disputeResolverId: BigNumberish;
|
|
92
80
|
fees: DisputeResolutionFee[];
|
|
@@ -61,13 +61,6 @@ export function encodeCreateDisputeResolver(args: CreateDisputeResolverArgs) {
|
|
|
61
61
|
]);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export function encodeActivateDisputeResolver(disputeResolverId: BigNumberish) {
|
|
65
|
-
return bosonAccountHandlerIface.encodeFunctionData(
|
|
66
|
-
"activateDisputeResolver",
|
|
67
|
-
[disputeResolverId]
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
64
|
export function encodeAddFeesToDisputeResolver(args: {
|
|
72
65
|
disputeResolverId: BigNumberish;
|
|
73
66
|
fees: DisputeResolutionFee[];
|
package/src/accounts/mixin.ts
CHANGED
|
@@ -493,22 +493,6 @@ export class AccountsMixin extends BaseCoreSDK {
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
/**
|
|
497
|
-
* Activates a dispute resolver account by calling the `AccountHandlerFacet` contract.
|
|
498
|
-
* Note, that the caller needs to have the ADMIN role.
|
|
499
|
-
* @param disputeResolverId - Id of dispute resolver to activate.
|
|
500
|
-
* @returns Transaction response.
|
|
501
|
-
*/
|
|
502
|
-
public async activateDisputeResolver(
|
|
503
|
-
disputeResolverId: BigNumberish
|
|
504
|
-
): Promise<TransactionResponse> {
|
|
505
|
-
return accounts.handler.activateDisputeResolver({
|
|
506
|
-
disputeResolverId,
|
|
507
|
-
contractAddress: this._protocolDiamond,
|
|
508
|
-
web3Lib: this._web3Lib
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
|
|
512
496
|
/**
|
|
513
497
|
* Adds fees to a dispute resolver account by calling the `AccountHandlerFacet`
|
|
514
498
|
* contract. Note, that the caller must be the specified `admin` address of the dispute
|
package/src/core-sdk.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { OfferMixin } from "./offers/mixin";
|
|
|
18
18
|
import { FundsMixin } from "./funds/mixin";
|
|
19
19
|
import { ExchangesMixin } from "./exchanges/mixin";
|
|
20
20
|
import { EventLogsMixin } from "./event-logs/mixin";
|
|
21
|
+
import { VoucherMixin } from "./voucher/mixin";
|
|
21
22
|
|
|
22
23
|
export class CoreSDK extends BaseCoreSDK {
|
|
23
24
|
/**
|
|
@@ -103,7 +104,8 @@ export interface CoreSDK
|
|
|
103
104
|
NativeMetaTxMixin,
|
|
104
105
|
GroupsMixin,
|
|
105
106
|
OrchestrationMixin,
|
|
106
|
-
EventLogsMixin
|
|
107
|
+
EventLogsMixin,
|
|
108
|
+
VoucherMixin {}
|
|
107
109
|
applyMixins(CoreSDK, [
|
|
108
110
|
MetadataMixin,
|
|
109
111
|
AccountsMixin,
|
|
@@ -115,5 +117,6 @@ applyMixins(CoreSDK, [
|
|
|
115
117
|
NativeMetaTxMixin,
|
|
116
118
|
GroupsMixin,
|
|
117
119
|
OrchestrationMixin,
|
|
118
|
-
EventLogsMixin
|
|
120
|
+
EventLogsMixin,
|
|
121
|
+
VoucherMixin
|
|
119
122
|
]);
|
package/src/erc721/handler.ts
CHANGED
|
@@ -7,9 +7,11 @@ export async function balanceOf(args: {
|
|
|
7
7
|
owner: string;
|
|
8
8
|
web3Lib: Web3LibAdapter;
|
|
9
9
|
}): Promise<string> {
|
|
10
|
+
const data = erc721Iface.encodeFunctionData("balanceOf", [args.owner]);
|
|
11
|
+
|
|
10
12
|
const result = await args.web3Lib.call({
|
|
11
13
|
to: args.contractAddress,
|
|
12
|
-
data:
|
|
14
|
+
data: data
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
const [balance] = erc721Iface.decodeFunctionResult("balanceOf", result);
|
package/src/meta-tx/handler.ts
CHANGED
|
@@ -24,7 +24,8 @@ import { bosonExchangeHandlerIface } from "../exchanges/interface";
|
|
|
24
24
|
import {
|
|
25
25
|
bosonOfferHandlerIface,
|
|
26
26
|
encodeCreateOffer,
|
|
27
|
-
encodeCreateOfferBatch
|
|
27
|
+
encodeCreateOfferBatch,
|
|
28
|
+
encodeReserveRange
|
|
28
29
|
} from "../offers/interface";
|
|
29
30
|
import { prepareDataSignatureParameters } from "../utils/signature";
|
|
30
31
|
import { Biconomy, GetRetriedHashesData } from "./biconomy";
|
|
@@ -34,6 +35,7 @@ import { encodeDepositFunds, encodeWithdrawFunds } from "../funds/interface";
|
|
|
34
35
|
import { bosonDisputeHandlerIface } from "../disputes/interface";
|
|
35
36
|
import { encodeCreateGroup } from "../groups/interface";
|
|
36
37
|
import { encodeCreateOfferWithCondition } from "../orchestration/interface";
|
|
38
|
+
import { encodePreMint } from "../voucher/interface";
|
|
37
39
|
|
|
38
40
|
export type BaseMetaTxArgs = {
|
|
39
41
|
web3Lib: Web3LibAdapter;
|
|
@@ -274,6 +276,32 @@ export async function signMetaTxCreateGroup(
|
|
|
274
276
|
});
|
|
275
277
|
}
|
|
276
278
|
|
|
279
|
+
export async function signMetaTxReserveRange(
|
|
280
|
+
args: BaseMetaTxArgs & {
|
|
281
|
+
offerId: BigNumberish;
|
|
282
|
+
length: BigNumberish;
|
|
283
|
+
}
|
|
284
|
+
) {
|
|
285
|
+
return signMetaTx({
|
|
286
|
+
...args,
|
|
287
|
+
functionName: "reserveRange(uint256,uint256)",
|
|
288
|
+
functionSignature: encodeReserveRange(args.offerId, args.length)
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export async function signMetaTxPreMint(
|
|
293
|
+
args: BaseMetaTxArgs & {
|
|
294
|
+
offerId: BigNumberish;
|
|
295
|
+
amount: BigNumberish;
|
|
296
|
+
}
|
|
297
|
+
) {
|
|
298
|
+
return signMetaTx({
|
|
299
|
+
...args,
|
|
300
|
+
functionName: "preMint(uint256,uint256)",
|
|
301
|
+
functionSignature: encodePreMint(args.offerId, args.amount)
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
277
305
|
export async function signMetaTxCreateOfferWithCondition(
|
|
278
306
|
args: BaseMetaTxArgs & {
|
|
279
307
|
offerToCreate: CreateOfferArgs;
|
package/src/meta-tx/mixin.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { MetaTxConfig, TransactionResponse } from "@bosonprotocol/common";
|
|
|
2
2
|
import { BigNumberish } from "@ethersproject/bignumber";
|
|
3
3
|
import { BytesLike } from "@ethersproject/bytes";
|
|
4
4
|
import { handler } from ".";
|
|
5
|
+
import { getOfferById } from "../offers/subgraph";
|
|
5
6
|
import { BaseCoreSDK } from "./../mixins/base-core-sdk";
|
|
6
7
|
import { GetRetriedHashesData } from "./biconomy";
|
|
7
8
|
export class MetaTxMixin extends BaseCoreSDK {
|
|
@@ -136,6 +137,38 @@ export class MetaTxMixin extends BaseCoreSDK {
|
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
public async signMetaTxReserveRange(
|
|
141
|
+
args: Omit<
|
|
142
|
+
Parameters<typeof handler.signMetaTxReserveRange>[0],
|
|
143
|
+
"web3Lib" | "metaTxHandlerAddress" | "chainId"
|
|
144
|
+
>
|
|
145
|
+
) {
|
|
146
|
+
return handler.signMetaTxReserveRange({
|
|
147
|
+
web3Lib: this._web3Lib,
|
|
148
|
+
metaTxHandlerAddress: this._protocolDiamond,
|
|
149
|
+
chainId: this._chainId,
|
|
150
|
+
...args
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public async signMetaTxPreMint(
|
|
155
|
+
args: Omit<
|
|
156
|
+
Parameters<typeof handler.signMetaTxPreMint>[0],
|
|
157
|
+
"web3Lib" | "metaTxHandlerAddress" | "chainId"
|
|
158
|
+
>
|
|
159
|
+
) {
|
|
160
|
+
const offerFromSubgraph = await getOfferById(
|
|
161
|
+
this._subgraphUrl,
|
|
162
|
+
args.offerId
|
|
163
|
+
);
|
|
164
|
+
return handler.signMetaTxPreMint({
|
|
165
|
+
web3Lib: this._web3Lib,
|
|
166
|
+
metaTxHandlerAddress: offerFromSubgraph.seller.voucherCloneAddress,
|
|
167
|
+
chainId: this._chainId,
|
|
168
|
+
...args
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
139
172
|
/**
|
|
140
173
|
* Encodes and signs a meta transaction for `createOfferWithCondition` that can be relayed.
|
|
141
174
|
* @param args - Meta transaction args.
|
package/src/offers/handler.ts
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
bosonOfferHandlerIface,
|
|
10
10
|
encodeCreateOffer,
|
|
11
|
-
encodeCreateOfferBatch
|
|
11
|
+
encodeCreateOfferBatch,
|
|
12
|
+
encodeReserveRange
|
|
12
13
|
} from "./interface";
|
|
13
14
|
import { getOfferById, getOffers } from "./subgraph";
|
|
14
15
|
import { storeMetadataOnTheGraph } from "./storage";
|
|
@@ -67,6 +68,29 @@ export async function createOfferBatch(args: {
|
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
export async function reserveRange(args: {
|
|
72
|
+
contractAddress: string;
|
|
73
|
+
subgraphUrl: string;
|
|
74
|
+
offerId: BigNumberish;
|
|
75
|
+
length: BigNumberish;
|
|
76
|
+
web3Lib: Web3LibAdapter;
|
|
77
|
+
}): Promise<TransactionResponse> {
|
|
78
|
+
const offerFromSubgraph = await getOfferById(args.subgraphUrl, args.offerId);
|
|
79
|
+
const signerAddress = await args.web3Lib.getSignerAddress();
|
|
80
|
+
|
|
81
|
+
checkIfOfferReservable(
|
|
82
|
+
args.offerId,
|
|
83
|
+
args.length,
|
|
84
|
+
signerAddress,
|
|
85
|
+
offerFromSubgraph
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return args.web3Lib.sendTransaction({
|
|
89
|
+
to: args.contractAddress,
|
|
90
|
+
data: encodeReserveRange(args.offerId, args.length)
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
70
94
|
export async function voidOffer(args: {
|
|
71
95
|
contractAddress: string;
|
|
72
96
|
subgraphUrl: string;
|
|
@@ -143,3 +167,20 @@ function checkIfOfferVoidable(
|
|
|
143
167
|
);
|
|
144
168
|
}
|
|
145
169
|
}
|
|
170
|
+
|
|
171
|
+
function checkIfOfferReservable(
|
|
172
|
+
offerId: BigNumberish,
|
|
173
|
+
length: BigNumberish,
|
|
174
|
+
signerAddress: string,
|
|
175
|
+
offerFromSubgraph?: OfferFieldsFragment
|
|
176
|
+
) {
|
|
177
|
+
checkIfOfferVoidable(offerId, signerAddress, offerFromSubgraph);
|
|
178
|
+
|
|
179
|
+
if (!length) {
|
|
180
|
+
throw new Error(`Range length is zero`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (offerFromSubgraph.quantityAvailable < length) {
|
|
184
|
+
throw new Error(`Range length is too large`);
|
|
185
|
+
}
|
|
186
|
+
}
|
package/src/offers/interface.ts
CHANGED
|
@@ -129,3 +129,13 @@ export function argsToOfferDurationsStruct(
|
|
|
129
129
|
resolutionPeriod: utils.timestamp.msToSec(resolutionPeriodDurationInMS)
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
export function encodeReserveRange(
|
|
134
|
+
offerId: BigNumberish,
|
|
135
|
+
length: BigNumberish
|
|
136
|
+
) {
|
|
137
|
+
return bosonOfferHandlerIface.encodeFunctionData("reserveRange", [
|
|
138
|
+
offerId,
|
|
139
|
+
length
|
|
140
|
+
]);
|
|
141
|
+
}
|
package/src/offers/mixin.ts
CHANGED
|
@@ -246,6 +246,28 @@ export class OfferMixin extends BaseCoreSDK {
|
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Reserves a range of vouchers to be associated with an offer
|
|
251
|
+
* @param offerId - Offer ID
|
|
252
|
+
* @param overrides - Optional overrides.
|
|
253
|
+
* @returns Transaction response.
|
|
254
|
+
*/
|
|
255
|
+
public async reserveRange(
|
|
256
|
+
offerId: BigNumberish,
|
|
257
|
+
length: BigNumberish,
|
|
258
|
+
overrides: Partial<{
|
|
259
|
+
contractAddress: string;
|
|
260
|
+
}> = {}
|
|
261
|
+
): Promise<TransactionResponse> {
|
|
262
|
+
return offers.handler.reserveRange({
|
|
263
|
+
offerId,
|
|
264
|
+
length,
|
|
265
|
+
subgraphUrl: this._subgraphUrl,
|
|
266
|
+
contractAddress: overrides.contractAddress || this._protocolDiamond,
|
|
267
|
+
web3Lib: this._web3Lib
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
249
271
|
/* -------------------------------------------------------------------------- */
|
|
250
272
|
/* ERC20 / Exchange Token related methods */
|
|
251
273
|
/* -------------------------------------------------------------------------- */
|
|
@@ -7,13 +7,19 @@ import {
|
|
|
7
7
|
} from "@bosonprotocol/common";
|
|
8
8
|
import {
|
|
9
9
|
encodeCreateOfferWithCondition,
|
|
10
|
+
encodeCreatePremintedOfferAddToGroup,
|
|
11
|
+
encodeCreatePremintedOfferWithCondition,
|
|
10
12
|
encodeCreateSellerAndOffer,
|
|
11
|
-
encodeCreateSellerAndOfferWithCondition
|
|
13
|
+
encodeCreateSellerAndOfferWithCondition,
|
|
14
|
+
encodeCreateSellerAndPremintedOffer,
|
|
15
|
+
encodeCreateSellerAndPremintedOfferWithCondition,
|
|
16
|
+
encodeRaiseAndEscalateDispute
|
|
12
17
|
} from "./interface";
|
|
13
18
|
import { storeMetadataOnTheGraph } from "../offers/storage";
|
|
14
19
|
|
|
15
20
|
import { CreateOfferArgs } from "../offers/types";
|
|
16
21
|
import { CreateSellerArgs } from "../accounts/types";
|
|
22
|
+
import { BigNumberish } from "@ethersproject/bignumber";
|
|
17
23
|
|
|
18
24
|
export async function createOfferAndSeller(args: {
|
|
19
25
|
offerToCreate: CreateOfferArgs;
|
|
@@ -95,3 +101,134 @@ export async function createSellerAndOfferWithCondition(args: {
|
|
|
95
101
|
)
|
|
96
102
|
});
|
|
97
103
|
}
|
|
104
|
+
|
|
105
|
+
export async function createPremintedOfferAddToGroup(args: {
|
|
106
|
+
offerToCreate: CreateOfferArgs;
|
|
107
|
+
reservedRangeLength: BigNumberish;
|
|
108
|
+
groupId: BigNumberish;
|
|
109
|
+
contractAddress: string;
|
|
110
|
+
web3Lib: Web3LibAdapter;
|
|
111
|
+
metadataStorage?: MetadataStorage;
|
|
112
|
+
theGraphStorage?: MetadataStorage;
|
|
113
|
+
}): Promise<TransactionResponse> {
|
|
114
|
+
utils.validation.createOfferArgsSchema.validateSync(args.offerToCreate, {
|
|
115
|
+
abortEarly: false
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
await storeMetadataOnTheGraph({
|
|
119
|
+
metadataUriOrHash: args.offerToCreate.metadataUri,
|
|
120
|
+
metadataStorage: args.metadataStorage,
|
|
121
|
+
theGraphStorage: args.theGraphStorage
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return args.web3Lib.sendTransaction({
|
|
125
|
+
to: args.contractAddress,
|
|
126
|
+
data: encodeCreatePremintedOfferAddToGroup(
|
|
127
|
+
args.offerToCreate,
|
|
128
|
+
args.reservedRangeLength,
|
|
129
|
+
args.groupId
|
|
130
|
+
)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export async function createPremintedOfferWithCondition(args: {
|
|
135
|
+
offerToCreate: CreateOfferArgs;
|
|
136
|
+
reservedRangeLength: BigNumberish;
|
|
137
|
+
contractAddress: string;
|
|
138
|
+
web3Lib: Web3LibAdapter;
|
|
139
|
+
metadataStorage?: MetadataStorage;
|
|
140
|
+
theGraphStorage?: MetadataStorage;
|
|
141
|
+
condition: ConditionStruct;
|
|
142
|
+
}): Promise<TransactionResponse> {
|
|
143
|
+
utils.validation.createOfferArgsSchema.validateSync(args.offerToCreate, {
|
|
144
|
+
abortEarly: false
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
await storeMetadataOnTheGraph({
|
|
148
|
+
metadataUriOrHash: args.offerToCreate.metadataUri,
|
|
149
|
+
metadataStorage: args.metadataStorage,
|
|
150
|
+
theGraphStorage: args.theGraphStorage
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
return args.web3Lib.sendTransaction({
|
|
154
|
+
to: args.contractAddress,
|
|
155
|
+
data: encodeCreatePremintedOfferWithCondition(
|
|
156
|
+
args.offerToCreate,
|
|
157
|
+
args.reservedRangeLength,
|
|
158
|
+
args.condition
|
|
159
|
+
)
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export async function createSellerAndPremintedOffer(args: {
|
|
164
|
+
sellerToCreate: CreateSellerArgs;
|
|
165
|
+
offerToCreate: CreateOfferArgs;
|
|
166
|
+
reservedRangeLength: BigNumberish;
|
|
167
|
+
contractAddress: string;
|
|
168
|
+
web3Lib: Web3LibAdapter;
|
|
169
|
+
metadataStorage?: MetadataStorage;
|
|
170
|
+
theGraphStorage?: MetadataStorage;
|
|
171
|
+
}): Promise<TransactionResponse> {
|
|
172
|
+
utils.validation.createOfferArgsSchema.validateSync(args.offerToCreate, {
|
|
173
|
+
abortEarly: false
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
await storeMetadataOnTheGraph({
|
|
177
|
+
metadataUriOrHash: args.offerToCreate.metadataUri,
|
|
178
|
+
metadataStorage: args.metadataStorage,
|
|
179
|
+
theGraphStorage: args.theGraphStorage
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return args.web3Lib.sendTransaction({
|
|
183
|
+
to: args.contractAddress,
|
|
184
|
+
data: encodeCreateSellerAndPremintedOffer(
|
|
185
|
+
args.sellerToCreate,
|
|
186
|
+
args.offerToCreate,
|
|
187
|
+
args.reservedRangeLength
|
|
188
|
+
)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export async function createSellerAndPremintedOfferWithCondition(args: {
|
|
193
|
+
sellerToCreate: CreateSellerArgs;
|
|
194
|
+
offerToCreate: CreateOfferArgs;
|
|
195
|
+
reservedRangeLength: BigNumberish;
|
|
196
|
+
contractAddress: string;
|
|
197
|
+
web3Lib: Web3LibAdapter;
|
|
198
|
+
metadataStorage?: MetadataStorage;
|
|
199
|
+
theGraphStorage?: MetadataStorage;
|
|
200
|
+
condition: ConditionStruct;
|
|
201
|
+
}): Promise<TransactionResponse> {
|
|
202
|
+
utils.validation.createOfferArgsSchema.validateSync(args.offerToCreate, {
|
|
203
|
+
abortEarly: false
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
await storeMetadataOnTheGraph({
|
|
207
|
+
metadataUriOrHash: args.offerToCreate.metadataUri,
|
|
208
|
+
metadataStorage: args.metadataStorage,
|
|
209
|
+
theGraphStorage: args.theGraphStorage
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
return args.web3Lib.sendTransaction({
|
|
213
|
+
to: args.contractAddress,
|
|
214
|
+
data: encodeCreateSellerAndPremintedOfferWithCondition(
|
|
215
|
+
args.sellerToCreate,
|
|
216
|
+
args.offerToCreate,
|
|
217
|
+
args.reservedRangeLength,
|
|
218
|
+
args.condition
|
|
219
|
+
)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export async function raiseAndEscalateDispute(args: {
|
|
224
|
+
exchangeId: BigNumberish;
|
|
225
|
+
contractAddress: string;
|
|
226
|
+
web3Lib: Web3LibAdapter;
|
|
227
|
+
metadataStorage?: MetadataStorage;
|
|
228
|
+
theGraphStorage?: MetadataStorage;
|
|
229
|
+
}): Promise<TransactionResponse> {
|
|
230
|
+
return args.web3Lib.sendTransaction({
|
|
231
|
+
to: args.contractAddress,
|
|
232
|
+
data: encodeRaiseAndEscalateDispute(args.exchangeId)
|
|
233
|
+
});
|
|
234
|
+
}
|