@bosonprotocol/core-sdk 1.44.0 → 1.44.1-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/disputes/handler.d.ts +14 -0
- package/dist/cjs/disputes/handler.d.ts.map +1 -1
- package/dist/cjs/disputes/handler.js.map +1 -1
- package/dist/cjs/disputes/interface.d.ts +4 -0
- package/dist/cjs/disputes/interface.d.ts.map +1 -1
- package/dist/cjs/disputes/interface.js +13 -3
- package/dist/cjs/disputes/interface.js.map +1 -1
- package/dist/cjs/disputes/mixin.d.ts +10 -0
- package/dist/cjs/disputes/mixin.d.ts.map +1 -1
- package/dist/cjs/disputes/mixin.js +17 -9
- package/dist/cjs/disputes/mixin.js.map +1 -1
- package/dist/cjs/exchanges/interface.d.ts +1 -0
- package/dist/cjs/exchanges/interface.d.ts.map +1 -1
- package/dist/cjs/exchanges/interface.js +4 -3
- package/dist/cjs/exchanges/interface.js.map +1 -1
- package/dist/cjs/funds/handler.d.ts +2 -2
- package/dist/cjs/funds/handler.js +1 -1
- package/dist/cjs/funds/interface.d.ts +1 -1
- package/dist/cjs/funds/interface.js +2 -2
- package/dist/cjs/funds/mixin.d.ts +4 -4
- package/dist/cjs/funds/mixin.js +3 -3
- package/dist/cjs/groups/interface.js +1 -1
- package/dist/cjs/groups/interface.js.map +1 -1
- package/dist/cjs/meta-tx/handler.d.ts +2 -2
- package/dist/cjs/meta-tx/handler.d.ts.map +1 -1
- package/dist/cjs/meta-tx/handler.js +18 -23
- package/dist/cjs/meta-tx/handler.js.map +1 -1
- package/dist/cjs/offers/interface.d.ts +3 -2
- package/dist/cjs/offers/interface.d.ts.map +1 -1
- package/dist/cjs/offers/interface.js +16 -7
- package/dist/cjs/offers/interface.js.map +1 -1
- package/dist/cjs/utils/signature.d.ts +5 -0
- package/dist/cjs/utils/signature.d.ts.map +1 -1
- package/dist/cjs/utils/signature.js +13 -0
- package/dist/cjs/utils/signature.js.map +1 -1
- package/dist/esm/disputes/handler.d.ts +14 -0
- package/dist/esm/disputes/handler.d.ts.map +1 -1
- package/dist/esm/disputes/handler.js.map +1 -1
- package/dist/esm/disputes/interface.d.ts +4 -0
- package/dist/esm/disputes/interface.d.ts.map +1 -1
- package/dist/esm/disputes/interface.js +13 -3
- package/dist/esm/disputes/interface.js.map +1 -1
- package/dist/esm/disputes/mixin.d.ts +10 -0
- package/dist/esm/disputes/mixin.d.ts.map +1 -1
- package/dist/esm/disputes/mixin.js +17 -9
- package/dist/esm/disputes/mixin.js.map +1 -1
- package/dist/esm/exchanges/interface.d.ts +1 -0
- package/dist/esm/exchanges/interface.d.ts.map +1 -1
- package/dist/esm/exchanges/interface.js +3 -2
- package/dist/esm/exchanges/interface.js.map +1 -1
- package/dist/esm/funds/handler.d.ts +2 -2
- package/dist/esm/funds/handler.js +1 -1
- package/dist/esm/funds/interface.d.ts +1 -1
- package/dist/esm/funds/interface.js +2 -2
- package/dist/esm/funds/mixin.d.ts +4 -4
- package/dist/esm/funds/mixin.js +2 -2
- package/dist/esm/groups/interface.js +1 -1
- package/dist/esm/groups/interface.js.map +1 -1
- package/dist/esm/meta-tx/handler.d.ts +2 -2
- package/dist/esm/meta-tx/handler.d.ts.map +1 -1
- package/dist/esm/meta-tx/handler.js +20 -25
- package/dist/esm/meta-tx/handler.js.map +1 -1
- package/dist/esm/offers/interface.d.ts +3 -2
- package/dist/esm/offers/interface.d.ts.map +1 -1
- package/dist/esm/offers/interface.js +17 -7
- package/dist/esm/offers/interface.js.map +1 -1
- package/dist/esm/utils/signature.d.ts +5 -0
- package/dist/esm/utils/signature.d.ts.map +1 -1
- package/dist/esm/utils/signature.js +12 -0
- package/dist/esm/utils/signature.js.map +1 -1
- package/package.json +3 -3
- package/src/disputes/handler.ts +63 -30
- package/src/disputes/interface.ts +27 -10
- package/src/disputes/mixin.ts +69 -33
- package/src/exchanges/interface.ts +6 -2
- package/src/funds/handler.ts +4 -4
- package/src/funds/interface.ts +2 -2
- package/src/funds/mixin.ts +6 -6
- package/src/groups/interface.ts +1 -1
- package/src/meta-tx/handler.ts +35 -31
- package/src/offers/interface.ts +36 -11
- package/src/utils/signature.ts +24 -0
package/src/disputes/handler.ts
CHANGED
|
@@ -188,38 +188,71 @@ export async function expireDisputeBatch(args: {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// Overload: returnTxInfo is true → returns TransactionRequest
|
|
191
|
-
export async function resolveDispute(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
export async function resolveDispute(
|
|
192
|
+
args:
|
|
193
|
+
| {
|
|
194
|
+
exchangeId: BigNumberish;
|
|
195
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
196
|
+
sigR: BytesLike;
|
|
197
|
+
sigS: BytesLike;
|
|
198
|
+
sigV: BigNumberish;
|
|
199
|
+
contractAddress: string;
|
|
200
|
+
web3Lib: Web3LibAdapter;
|
|
201
|
+
returnTxInfo: true;
|
|
202
|
+
}
|
|
203
|
+
| {
|
|
204
|
+
exchangeId: BigNumberish;
|
|
205
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
206
|
+
signature: string;
|
|
207
|
+
contractAddress: string;
|
|
208
|
+
web3Lib: Web3LibAdapter;
|
|
209
|
+
returnTxInfo: true;
|
|
210
|
+
}
|
|
211
|
+
): Promise<TransactionRequest>;
|
|
201
212
|
// Overload: returnTxInfo is false or undefined → returns TransactionResponse
|
|
202
|
-
export async function resolveDispute(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
export async function resolveDispute(
|
|
214
|
+
args:
|
|
215
|
+
| {
|
|
216
|
+
exchangeId: BigNumberish;
|
|
217
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
218
|
+
sigR: BytesLike;
|
|
219
|
+
sigS: BytesLike;
|
|
220
|
+
sigV: BigNumberish;
|
|
221
|
+
contractAddress: string;
|
|
222
|
+
web3Lib: Web3LibAdapter;
|
|
223
|
+
returnTxInfo?: false | undefined;
|
|
224
|
+
}
|
|
225
|
+
| {
|
|
226
|
+
exchangeId: BigNumberish;
|
|
227
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
228
|
+
signature: string;
|
|
229
|
+
contractAddress: string;
|
|
230
|
+
web3Lib: Web3LibAdapter;
|
|
231
|
+
returnTxInfo?: false | undefined;
|
|
232
|
+
}
|
|
233
|
+
): Promise<TransactionResponse>;
|
|
212
234
|
// Implementation
|
|
213
|
-
export async function resolveDispute(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
235
|
+
export async function resolveDispute(
|
|
236
|
+
args:
|
|
237
|
+
| {
|
|
238
|
+
exchangeId: BigNumberish;
|
|
239
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
240
|
+
sigR: BytesLike;
|
|
241
|
+
sigS: BytesLike;
|
|
242
|
+
sigV: BigNumberish;
|
|
243
|
+
contractAddress: string;
|
|
244
|
+
web3Lib: Web3LibAdapter;
|
|
245
|
+
returnTxInfo?: boolean;
|
|
246
|
+
}
|
|
247
|
+
| {
|
|
248
|
+
exchangeId: BigNumberish;
|
|
249
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
250
|
+
signature: string;
|
|
251
|
+
contractAddress: string;
|
|
252
|
+
web3Lib: Web3LibAdapter;
|
|
253
|
+
returnTxInfo?: boolean;
|
|
254
|
+
}
|
|
255
|
+
): Promise<TransactionResponse | TransactionRequest> {
|
|
223
256
|
const transactionRequest = {
|
|
224
257
|
to: args.contractAddress,
|
|
225
258
|
data: encodeResolveDispute(args)
|
|
@@ -2,6 +2,7 @@ import { abis } from "@bosonprotocol/common";
|
|
|
2
2
|
import { Interface } from "@ethersproject/abi";
|
|
3
3
|
import { BigNumberish } from "@ethersproject/bignumber";
|
|
4
4
|
import { BytesLike } from "@ethersproject/bytes";
|
|
5
|
+
import { rebuildSignature } from "../utils/signature";
|
|
5
6
|
|
|
6
7
|
export const bosonDisputeHandlerIface = new Interface(
|
|
7
8
|
abis.IBosonDisputeHandlerABI
|
|
@@ -63,19 +64,35 @@ export function encodeRefuseEscalatedDispute(exchangeId: BigNumberish) {
|
|
|
63
64
|
]);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
export function encodeResolveDispute(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
export function encodeResolveDispute(
|
|
68
|
+
args:
|
|
69
|
+
| {
|
|
70
|
+
exchangeId: BigNumberish;
|
|
71
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
72
|
+
sigR: BytesLike;
|
|
73
|
+
sigS: BytesLike;
|
|
74
|
+
sigV: BigNumberish;
|
|
75
|
+
}
|
|
76
|
+
| {
|
|
77
|
+
exchangeId: BigNumberish;
|
|
78
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
79
|
+
signature: string;
|
|
80
|
+
}
|
|
81
|
+
) {
|
|
82
|
+
let signature: string;
|
|
83
|
+
if (!("signature" in args)) {
|
|
84
|
+
signature = rebuildSignature({
|
|
85
|
+
r: args.sigR.toString(),
|
|
86
|
+
s: args.sigS.toString(),
|
|
87
|
+
v: Number(args.sigV)
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
signature = args.signature;
|
|
91
|
+
}
|
|
73
92
|
return bosonDisputeHandlerIface.encodeFunctionData("resolveDispute", [
|
|
74
93
|
args.exchangeId,
|
|
75
94
|
args.buyerPercentBasisPoints,
|
|
76
|
-
|
|
77
|
-
args.sigS,
|
|
78
|
-
args.sigV
|
|
95
|
+
signature
|
|
79
96
|
]);
|
|
80
97
|
}
|
|
81
98
|
|
package/src/disputes/mixin.ts
CHANGED
|
@@ -254,40 +254,76 @@ export class DisputesMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
|
|
|
254
254
|
* - `args.sigV` - v signature value of counterparty.
|
|
255
255
|
* @returns Transaction response.
|
|
256
256
|
*/
|
|
257
|
-
public async resolveDispute(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
257
|
+
public async resolveDispute(
|
|
258
|
+
args:
|
|
259
|
+
| {
|
|
260
|
+
exchangeId: BigNumberish;
|
|
261
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
262
|
+
sigR: BytesLike;
|
|
263
|
+
sigS: BytesLike;
|
|
264
|
+
sigV: BigNumberish;
|
|
265
|
+
returnTxInfo: true;
|
|
266
|
+
}
|
|
267
|
+
| {
|
|
268
|
+
exchangeId: BigNumberish;
|
|
269
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
270
|
+
signature: string;
|
|
271
|
+
returnTxInfo: true;
|
|
272
|
+
}
|
|
273
|
+
): Promise<TransactionRequest>;
|
|
274
|
+
public async resolveDispute(
|
|
275
|
+
args:
|
|
276
|
+
| {
|
|
277
|
+
exchangeId: BigNumberish;
|
|
278
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
279
|
+
sigR: BytesLike;
|
|
280
|
+
sigS: BytesLike;
|
|
281
|
+
sigV: BigNumberish;
|
|
282
|
+
returnTxInfo?: false | undefined;
|
|
283
|
+
}
|
|
284
|
+
| {
|
|
285
|
+
exchangeId: BigNumberish;
|
|
286
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
287
|
+
signature: string;
|
|
288
|
+
returnTxInfo?: false | undefined;
|
|
289
|
+
}
|
|
290
|
+
): Promise<TransactionResponse>;
|
|
291
|
+
public async resolveDispute(
|
|
292
|
+
args:
|
|
293
|
+
| {
|
|
294
|
+
exchangeId: BigNumberish;
|
|
295
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
296
|
+
sigR: BytesLike;
|
|
297
|
+
sigS: BytesLike;
|
|
298
|
+
sigV: BigNumberish;
|
|
299
|
+
returnTxInfo?: boolean;
|
|
300
|
+
}
|
|
301
|
+
| {
|
|
302
|
+
exchangeId: BigNumberish;
|
|
303
|
+
buyerPercentBasisPoints: BigNumberish;
|
|
304
|
+
signature: string;
|
|
305
|
+
returnTxInfo?: boolean;
|
|
306
|
+
}
|
|
307
|
+
): Promise<TransactionResponse | TransactionRequest> {
|
|
281
308
|
const { returnTxInfo } = args;
|
|
282
|
-
const resolveArgs =
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
309
|
+
const resolveArgs =
|
|
310
|
+
"signature" in args
|
|
311
|
+
? {
|
|
312
|
+
exchangeId: args.exchangeId,
|
|
313
|
+
buyerPercentBasisPoints: args.buyerPercentBasisPoints,
|
|
314
|
+
signature: args.signature,
|
|
315
|
+
contractAddress: this._protocolDiamond,
|
|
316
|
+
web3Lib: this._web3Lib
|
|
317
|
+
}
|
|
318
|
+
: ({
|
|
319
|
+
exchangeId: args.exchangeId,
|
|
320
|
+
buyerPercentBasisPoints: args.buyerPercentBasisPoints,
|
|
321
|
+
sigR: args.sigR,
|
|
322
|
+
sigS: args.sigS,
|
|
323
|
+
sigV: args.sigV,
|
|
324
|
+
contractAddress: this._protocolDiamond,
|
|
325
|
+
web3Lib: this._web3Lib
|
|
326
|
+
} as const satisfies Parameters<typeof resolveDispute>[0]);
|
|
291
327
|
|
|
292
328
|
if (returnTxInfo === true) {
|
|
293
329
|
return resolveDispute({
|
|
@@ -6,8 +6,12 @@ export const bosonExchangeHandlerIface = new Interface(
|
|
|
6
6
|
abis.IBosonExchangeHandlerABI
|
|
7
7
|
);
|
|
8
8
|
|
|
9
|
+
export const bosonExchangeCommitHandlerIface = new Interface(
|
|
10
|
+
abis.IBosonExchangeCommitHandlerABI
|
|
11
|
+
);
|
|
12
|
+
|
|
9
13
|
export function encodeCommitToOffer(buyer: string, offerId: BigNumberish) {
|
|
10
|
-
return
|
|
14
|
+
return bosonExchangeCommitHandlerIface.encodeFunctionData("commitToOffer", [
|
|
11
15
|
buyer,
|
|
12
16
|
offerId
|
|
13
17
|
]);
|
|
@@ -18,7 +22,7 @@ export function encodeCommitToConditionalOffer(
|
|
|
18
22
|
offerId: BigNumberish,
|
|
19
23
|
tokenId: BigNumberish
|
|
20
24
|
) {
|
|
21
|
-
return
|
|
25
|
+
return bosonExchangeCommitHandlerIface.encodeFunctionData(
|
|
22
26
|
"commitToConditionalOffer",
|
|
23
27
|
[buyer, offerId, tokenId]
|
|
24
28
|
);
|
package/src/funds/handler.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { getFunds } from "./subgraph";
|
|
|
11
11
|
|
|
12
12
|
// Overload: returnTxInfo is true -> returns TransactionRequest
|
|
13
13
|
export async function depositFunds(args: {
|
|
14
|
-
|
|
14
|
+
entityId: BigNumberish;
|
|
15
15
|
fundsTokenAddress?: string;
|
|
16
16
|
fundsAmount: BigNumberish;
|
|
17
17
|
contractAddress: string;
|
|
@@ -21,7 +21,7 @@ export async function depositFunds(args: {
|
|
|
21
21
|
|
|
22
22
|
// Overload: returnTxInfo is false or undefined -> returns TransactionResponse
|
|
23
23
|
export async function depositFunds(args: {
|
|
24
|
-
|
|
24
|
+
entityId: BigNumberish;
|
|
25
25
|
fundsTokenAddress?: string;
|
|
26
26
|
fundsAmount: BigNumberish;
|
|
27
27
|
contractAddress: string;
|
|
@@ -31,7 +31,7 @@ export async function depositFunds(args: {
|
|
|
31
31
|
|
|
32
32
|
// Implementation
|
|
33
33
|
export async function depositFunds(args: {
|
|
34
|
-
|
|
34
|
+
entityId: BigNumberish;
|
|
35
35
|
fundsTokenAddress?: string;
|
|
36
36
|
fundsAmount: BigNumberish;
|
|
37
37
|
contractAddress: string;
|
|
@@ -49,7 +49,7 @@ export async function depositFunds(args: {
|
|
|
49
49
|
const transactionRequest: TransactionRequest = {
|
|
50
50
|
to: args.contractAddress,
|
|
51
51
|
data: encodeDepositFunds(
|
|
52
|
-
args.
|
|
52
|
+
args.entityId,
|
|
53
53
|
fundsTokenAddress,
|
|
54
54
|
args.fundsAmount
|
|
55
55
|
),
|
package/src/funds/interface.ts
CHANGED
|
@@ -5,12 +5,12 @@ import { BigNumberish } from "@ethersproject/bignumber";
|
|
|
5
5
|
export const bosonFundsHandlerIface = new Interface(abis.IBosonFundsHandlerABI);
|
|
6
6
|
|
|
7
7
|
export function encodeDepositFunds(
|
|
8
|
-
|
|
8
|
+
entityId: BigNumberish,
|
|
9
9
|
tokenAddress: string,
|
|
10
10
|
amount: BigNumberish
|
|
11
11
|
) {
|
|
12
12
|
return bosonFundsHandlerIface.encodeFunctionData("depositFunds", [
|
|
13
|
-
|
|
13
|
+
entityId,
|
|
14
14
|
tokenAddress,
|
|
15
15
|
amount
|
|
16
16
|
]);
|
package/src/funds/mixin.ts
CHANGED
|
@@ -21,8 +21,8 @@ export class FundsMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Deposit funds by calling the `FundsHandlerFacet` contract.
|
|
24
|
-
* This transaction only succeeds if there is an existing
|
|
25
|
-
* @param
|
|
24
|
+
* This transaction only succeeds if there is an existing entity account for connected signer.
|
|
25
|
+
* @param entityId - ID of the account to deposit funds for.
|
|
26
26
|
* @param fundsAmount - Amount of funds.
|
|
27
27
|
* @param fundsTokenAddress - Address of funds token.
|
|
28
28
|
* @param overrides - Optional overrides.
|
|
@@ -30,7 +30,7 @@ export class FundsMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
|
|
|
30
30
|
*/
|
|
31
31
|
// Overload: returnTxInfo is true → returns TransactionRequest
|
|
32
32
|
public async depositFunds(
|
|
33
|
-
|
|
33
|
+
entityId: BigNumberish,
|
|
34
34
|
fundsAmount: BigNumberish,
|
|
35
35
|
fundsTokenAddress: string,
|
|
36
36
|
overrides: Partial<{
|
|
@@ -42,7 +42,7 @@ export class FundsMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
|
|
|
42
42
|
|
|
43
43
|
// Overload: returnTxInfo is false or undefined → returns TransactionResponse
|
|
44
44
|
public async depositFunds(
|
|
45
|
-
|
|
45
|
+
entityId: BigNumberish,
|
|
46
46
|
fundsAmount: BigNumberish,
|
|
47
47
|
fundsTokenAddress?: string,
|
|
48
48
|
overrides?: Partial<{
|
|
@@ -54,7 +54,7 @@ export class FundsMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
|
|
|
54
54
|
|
|
55
55
|
// Implementation
|
|
56
56
|
public async depositFunds(
|
|
57
|
-
|
|
57
|
+
entityId: BigNumberish,
|
|
58
58
|
fundsAmount: BigNumberish,
|
|
59
59
|
fundsTokenAddress: string = AddressZero,
|
|
60
60
|
overrides: Partial<{
|
|
@@ -66,7 +66,7 @@ export class FundsMixin<T extends Web3LibAdapter> extends BaseCoreSDK<T> {
|
|
|
66
66
|
const { returnTxInfo } = overrides;
|
|
67
67
|
|
|
68
68
|
const depositArgs = {
|
|
69
|
-
|
|
69
|
+
entityId,
|
|
70
70
|
fundsAmount,
|
|
71
71
|
fundsTokenAddress,
|
|
72
72
|
web3Lib: this._web3Lib,
|
package/src/groups/interface.ts
CHANGED
package/src/meta-tx/handler.ts
CHANGED
|
@@ -22,14 +22,20 @@ import {
|
|
|
22
22
|
encodeOptInToSellerUpdate,
|
|
23
23
|
encodeUpdateSeller
|
|
24
24
|
} from "../accounts/interface";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
bosonExchangeCommitHandlerIface,
|
|
27
|
+
bosonExchangeHandlerIface
|
|
28
|
+
} from "../exchanges/interface";
|
|
26
29
|
import {
|
|
27
30
|
bosonOfferHandlerIface,
|
|
28
31
|
encodeCreateOffer,
|
|
29
32
|
encodeCreateOfferBatch,
|
|
30
33
|
encodeReserveRange
|
|
31
34
|
} from "../offers/interface";
|
|
32
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
prepareDataSignatureParameters,
|
|
37
|
+
rebuildSignature
|
|
38
|
+
} from "../utils/signature";
|
|
33
39
|
import {
|
|
34
40
|
Biconomy,
|
|
35
41
|
ForwarderDomainData,
|
|
@@ -476,7 +482,7 @@ export async function signMetaTxCreateOffer(
|
|
|
476
482
|
return signMetaTx({
|
|
477
483
|
...args,
|
|
478
484
|
functionName:
|
|
479
|
-
"createOffer((uint256,uint256,uint256,uint256,uint256,uint256,address,uint8,string,string,bool,uint256,(address[],uint256[])[]),(uint256,uint256,uint256,uint256),(uint256,uint256,uint256),uint256,uint256,uint256)",
|
|
485
|
+
"createOffer((uint256,uint256,uint256,uint256,uint256,uint256,address,uint8,uint8,string,string,bool,uint256,(address[],uint256[])[],uint256),(uint256,uint256,uint256,uint256),(uint256,uint256,uint256),(uint256,address),uint256,uint256)",
|
|
480
486
|
functionSignature: encodeCreateOffer(args.createOfferArgs)
|
|
481
487
|
});
|
|
482
488
|
}
|
|
@@ -508,7 +514,7 @@ export async function signMetaTxCreateOfferBatch(
|
|
|
508
514
|
return signMetaTx({
|
|
509
515
|
...args,
|
|
510
516
|
functionName:
|
|
511
|
-
"createOfferBatch((uint256,uint256,uint256,uint256,uint256,uint256,address,uint8,string,string,bool,uint256,(address[],uint256[])[])[],(uint256,uint256,uint256,uint256)[],(uint256,uint256,uint256)[],uint256[],uint256[],uint256[])",
|
|
517
|
+
"createOfferBatch((uint256,uint256,uint256,uint256,uint256,uint256,address,uint8,uint8,string,string,bool,uint256,(address[],uint256[])[],uint256)[],(uint256,uint256,uint256,uint256)[],(uint256,uint256,uint256)[],(uint256,address)[],uint256[],uint256[])",
|
|
512
518
|
functionSignature: encodeCreateOfferBatch(args.createOffersArgs)
|
|
513
519
|
});
|
|
514
520
|
}
|
|
@@ -813,7 +819,7 @@ export async function signMetaTxCreateOfferWithCondition(
|
|
|
813
819
|
return signMetaTx({
|
|
814
820
|
...args,
|
|
815
821
|
functionName:
|
|
816
|
-
"createOfferWithCondition((uint256,uint256,uint256,uint256,uint256,uint256,address,uint8,string,string,bool,uint256,(address[],uint256[])[]),(uint256,uint256,uint256,uint256),(uint256,uint256,uint256),uint256,(uint8,uint8,address,uint8,uint256,uint256,uint256,uint256),uint256,uint256)",
|
|
822
|
+
"createOfferWithCondition((uint256,uint256,uint256,uint256,uint256,uint256,address,uint8,uint8,string,string,bool,uint256,(address[],uint256[])[],uint256),(uint256,uint256,uint256,uint256),(uint256,uint256,uint256),(uint256,address),(uint8,uint8,address,uint8,uint256,uint256,uint256,uint256),uint256,uint256)",
|
|
817
823
|
functionSignature: encodeCreateOfferWithCondition(
|
|
818
824
|
args.offerToCreate,
|
|
819
825
|
args.condition
|
|
@@ -871,7 +877,7 @@ export async function signMetaTxCommitToOffer(
|
|
|
871
877
|
return {
|
|
872
878
|
...signatureParams,
|
|
873
879
|
functionName,
|
|
874
|
-
functionSignature:
|
|
880
|
+
functionSignature: bosonExchangeCommitHandlerIface.encodeFunctionData(
|
|
875
881
|
"commitToOffer",
|
|
876
882
|
[buyerAddress, args.offerId]
|
|
877
883
|
)
|
|
@@ -931,7 +937,7 @@ export async function signMetaTxCommitToConditionalOffer(
|
|
|
931
937
|
return {
|
|
932
938
|
...signatureParams,
|
|
933
939
|
functionName,
|
|
934
|
-
functionSignature:
|
|
940
|
+
functionSignature: bosonExchangeCommitHandlerIface.encodeFunctionData(
|
|
935
941
|
"commitToConditionalOffer",
|
|
936
942
|
[buyerAddress, args.offerId, args.tokenId]
|
|
937
943
|
)
|
|
@@ -999,21 +1005,25 @@ export async function signMetaTxResolveDispute(
|
|
|
999
1005
|
args: BaseMetaTxArgs & {
|
|
1000
1006
|
exchangeId: BigNumberish;
|
|
1001
1007
|
buyerPercent: BigNumberish;
|
|
1002
|
-
counterpartySig:
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1008
|
+
counterpartySig:
|
|
1009
|
+
| {
|
|
1010
|
+
r: string;
|
|
1011
|
+
s: string;
|
|
1012
|
+
v: number;
|
|
1013
|
+
}
|
|
1014
|
+
| string;
|
|
1007
1015
|
}
|
|
1008
1016
|
): Promise<SignedMetaTx> {
|
|
1009
|
-
const functionName = "resolveDispute(uint256,uint256,
|
|
1017
|
+
const functionName = "resolveDispute(uint256,uint256,bytes)";
|
|
1018
|
+
const counterpartySig =
|
|
1019
|
+
typeof args.counterpartySig === "string"
|
|
1020
|
+
? args.counterpartySig
|
|
1021
|
+
: rebuildSignature(args.counterpartySig);
|
|
1010
1022
|
|
|
1011
1023
|
const disputeResolutionType = [
|
|
1012
1024
|
{ name: "exchangeId", type: "uint256" },
|
|
1013
1025
|
{ name: "buyerPercentBasisPoints", type: "uint256" },
|
|
1014
|
-
{ name: "
|
|
1015
|
-
{ name: "sigS", type: "bytes32" },
|
|
1016
|
-
{ name: "sigV", type: "uint8" }
|
|
1026
|
+
{ name: "signature", type: "bytes" }
|
|
1017
1027
|
];
|
|
1018
1028
|
|
|
1019
1029
|
const metaTransactionType = [
|
|
@@ -1037,9 +1047,7 @@ export async function signMetaTxResolveDispute(
|
|
|
1037
1047
|
disputeResolutionDetails: {
|
|
1038
1048
|
exchangeId: args.exchangeId.toString(),
|
|
1039
1049
|
buyerPercentBasisPoints: args.buyerPercent.toString(),
|
|
1040
|
-
|
|
1041
|
-
sigS: args.counterpartySig.s,
|
|
1042
|
-
sigV: args.counterpartySig.v
|
|
1050
|
+
signature: counterpartySig
|
|
1043
1051
|
}
|
|
1044
1052
|
};
|
|
1045
1053
|
|
|
@@ -1058,13 +1066,7 @@ export async function signMetaTxResolveDispute(
|
|
|
1058
1066
|
functionSignature: bosonDisputeHandlerIface.encodeFunctionData(
|
|
1059
1067
|
// remove params in brackets from string
|
|
1060
1068
|
functionName.replace(/\(([^)]*)\)[^(]*$/, ""),
|
|
1061
|
-
[
|
|
1062
|
-
args.exchangeId,
|
|
1063
|
-
args.buyerPercent,
|
|
1064
|
-
args.counterpartySig.r,
|
|
1065
|
-
args.counterpartySig.s,
|
|
1066
|
-
args.counterpartySig.v
|
|
1067
|
-
]
|
|
1069
|
+
[args.exchangeId, args.buyerPercent, counterpartySig]
|
|
1068
1070
|
)
|
|
1069
1071
|
};
|
|
1070
1072
|
}
|
|
@@ -1147,7 +1149,7 @@ export async function signMetaTxWithdrawFunds(
|
|
|
1147
1149
|
|
|
1148
1150
|
export async function signMetaTxDepositFunds(
|
|
1149
1151
|
args: BaseMetaTxArgs & {
|
|
1150
|
-
|
|
1152
|
+
entityId: BigNumberish;
|
|
1151
1153
|
fundsTokenAddress: string;
|
|
1152
1154
|
fundsAmount: BigNumberish;
|
|
1153
1155
|
}
|
|
@@ -1166,7 +1168,7 @@ export async function signMetaTxDepositFunds(
|
|
|
1166
1168
|
...args,
|
|
1167
1169
|
functionName: "depositFunds(uint256,address,uint256)",
|
|
1168
1170
|
functionSignature: encodeDepositFunds(
|
|
1169
|
-
args.
|
|
1171
|
+
args.entityId,
|
|
1170
1172
|
args.fundsTokenAddress,
|
|
1171
1173
|
args.fundsAmount
|
|
1172
1174
|
)
|
|
@@ -1268,9 +1270,11 @@ export async function relayMetaTransaction(args: {
|
|
|
1268
1270
|
metaTx.params.functionName,
|
|
1269
1271
|
metaTx.params.functionSignature,
|
|
1270
1272
|
metaTx.params.nonce,
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1273
|
+
rebuildSignature({
|
|
1274
|
+
r: metaTx.params.sigR.toString(),
|
|
1275
|
+
s: metaTx.params.sigS.toString(),
|
|
1276
|
+
v: Number(metaTx.params.sigV)
|
|
1277
|
+
})
|
|
1274
1278
|
],
|
|
1275
1279
|
from: metaTx.params.userAddress
|
|
1276
1280
|
});
|