@thesingularitynetwork/darkswap-sdk 0.1.6 → 0.1.7

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/index.esm.js CHANGED
@@ -4234,14 +4234,14 @@ async function generateProCreateOrderProof(param) {
4234
4234
  }
4235
4235
  if (param.newBalanceNote.amount < 0n
4236
4236
  || param.oldBalanceNote.amount <= 0n
4237
- || param.inNote.amount <= 0n
4237
+ || param.inAmount <= 0n
4238
4238
  || param.orderNote.amount <= 0n) {
4239
4239
  throw new DarkSwapProofError("Invalid note amount");
4240
4240
  }
4241
4241
  if (param.orderNote.amount != param.oldBalanceNote.amount - param.newBalanceNote.amount) {
4242
4242
  throw new DarkSwapProofError("Invalid order amount");
4243
4243
  }
4244
- const feeAmount = param.inNote.amount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
4244
+ const feeAmount = param.inAmount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
4245
4245
  const [[fuzkPubKeyX, fuzkPubKeyY], fuzkPriKey] = await generateKeyPair(param.signedMessage);
4246
4246
  let newBalanceFooter = EMPTY_FOOTER;
4247
4247
  if (param.oldBalanceNote.amount != 0n) {
@@ -4277,8 +4277,8 @@ async function generateProCreateOrderProof(param) {
4277
4277
  order_note_footer: bn_to_0xhex(orderNoteFooter),
4278
4278
  order_asset: bn_to_0xhex(encodeAddress(param.orderNote.asset)),
4279
4279
  order_amount: bn_to_0xhex(param.orderNote.amount),
4280
- in_asset: bn_to_0xhex(encodeAddress(param.inNote.asset)),
4281
- in_amount: bn_to_0xhex(param.inNote.amount),
4280
+ in_asset: bn_to_0xhex(encodeAddress(param.inAsset)),
4281
+ in_amount: bn_to_0xhex(param.inAmount),
4282
4282
  pub_key: [fuzkPubKeyX.toString(), fuzkPubKeyY.toString()],
4283
4283
  signature: uint8ArrayToNumberArray(signature),
4284
4284
  };
@@ -4312,7 +4312,13 @@ class ProCreateOrderContext extends BaseContext {
4312
4312
  writable: true,
4313
4313
  value: void 0
4314
4314
  });
4315
- Object.defineProperty(this, "_swapInNote", {
4315
+ Object.defineProperty(this, "_swapInAsset", {
4316
+ enumerable: true,
4317
+ configurable: true,
4318
+ writable: true,
4319
+ value: void 0
4320
+ });
4321
+ Object.defineProperty(this, "_swapInAmount", {
4316
4322
  enumerable: true,
4317
4323
  configurable: true,
4318
4324
  writable: true,
@@ -4343,11 +4349,17 @@ class ProCreateOrderContext extends BaseContext {
4343
4349
  get orderNote() {
4344
4350
  return this._orderNote;
4345
4351
  }
4346
- set swapInNote(swapInNote) {
4347
- this._swapInNote = swapInNote;
4352
+ set swapInAsset(swapInAsset) {
4353
+ this._swapInAsset = swapInAsset;
4348
4354
  }
4349
- get swapInNote() {
4350
- return this._swapInNote;
4355
+ get swapInAsset() {
4356
+ return this._swapInAsset;
4357
+ }
4358
+ set swapInAmount(swapInAmount) {
4359
+ this._swapInAmount = swapInAmount;
4360
+ }
4361
+ get swapInAmount() {
4362
+ return this._swapInAmount;
4351
4363
  }
4352
4364
  set oldBalance(oldBalance) {
4353
4365
  this._oldBalance = oldBalance;
@@ -4385,22 +4397,23 @@ class ProCreateOrderService extends BaseContractService {
4385
4397
  super(_darkSwap);
4386
4398
  }
4387
4399
  async prepare(address, orderAsset, orderAmount, swapInAsset, swapInAmount, balanceNote, signature) {
4388
- const [pubKey, privKey] = await generateKeyPair(signature);
4400
+ const [pubKey] = await generateKeyPair(signature);
4389
4401
  const orderNote = createOrderNoteExt(address, orderAsset, orderAmount, FEE_RATIO, pubKey);
4390
4402
  const newBalance = createNote(address, orderAsset, balanceNote.amount - orderAmount, pubKey);
4391
- const swapInNote = createNote(address, swapInAsset, swapInAmount, pubKey);
4392
4403
  const context = new ProCreateOrderContext(signature);
4393
4404
  context.orderNote = orderNote;
4394
- context.swapInNote = swapInNote;
4405
+ context.swapInAsset = swapInAsset;
4406
+ context.swapInAmount = swapInAmount;
4395
4407
  context.oldBalance = balanceNote;
4396
4408
  context.newBalance = newBalance;
4397
4409
  context.address = address;
4398
- return { context, orderNote, swapInNote, newBalance };
4410
+ return { context, orderNote, newBalance };
4399
4411
  }
4400
4412
  async generateProof(context) {
4401
4413
  if (!context
4402
4414
  || !context.orderNote
4403
- || !context.swapInNote
4415
+ || !context.swapInAsset
4416
+ || !context.swapInAmount
4404
4417
  || !context.oldBalance
4405
4418
  || !context.newBalance
4406
4419
  || !context.address
@@ -4415,7 +4428,8 @@ class ProCreateOrderService extends BaseContractService {
4415
4428
  orderNote: context.orderNote,
4416
4429
  oldBalanceNote: context.oldBalance,
4417
4430
  newBalanceNote: context.newBalance,
4418
- inNote: context.swapInNote,
4431
+ inAsset: context.swapInAsset,
4432
+ inAmount: context.swapInAmount,
4419
4433
  address: context.address,
4420
4434
  signedMessage: context.signature,
4421
4435
  });
@@ -4424,7 +4438,13 @@ class ProCreateOrderService extends BaseContractService {
4424
4438
  }
4425
4439
  async execute(context) {
4426
4440
  await this.generateProof(context);
4427
- if (!context || !context.orderNote || !context.swapInNote || !context.oldBalance || !context.newBalance || !context.proof) {
4441
+ if (!context
4442
+ || !context.orderNote
4443
+ || !context.swapInAsset
4444
+ || !context.swapInAmount
4445
+ || !context.oldBalance
4446
+ || !context.newBalance
4447
+ || !context.proof) {
4428
4448
  throw new DarkSwapError('Invalid context');
4429
4449
  }
4430
4450
  const contract = new ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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14 @@ async function generateProCreateOrderProof(param) {
4234
4234
  }
4235
4235
  if (param.newBalanceNote.amount < 0n
4236
4236
  || param.oldBalanceNote.amount <= 0n
4237
- || param.inNote.amount <= 0n
4237
+ || param.inAmount <= 0n
4238
4238
  || param.orderNote.amount <= 0n) {
4239
4239
  throw new DarkSwapProofError("Invalid note amount");
4240
4240
  }
4241
4241
  if (param.orderNote.amount != param.oldBalanceNote.amount - param.newBalanceNote.amount) {
4242
4242
  throw new DarkSwapProofError("Invalid order amount");
4243
4243
  }
4244
- const feeAmount = param.inNote.amount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
4244
+ const feeAmount = param.inAmount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
4245
4245
  const [[fuzkPubKeyX, fuzkPubKeyY], fuzkPriKey] = await generateKeyPair(param.signedMessage);
4246
4246
  let newBalanceFooter = EMPTY_FOOTER;
4247
4247
  if (param.oldBalanceNote.amount != 0n) {
@@ -4277,8 +4277,8 @@ async function generateProCreateOrderProof(param) {
4277
4277
  order_note_footer: bn_to_0xhex(orderNoteFooter),
4278
4278
  order_asset: bn_to_0xhex(encodeAddress(param.orderNote.asset)),
4279
4279
  order_amount: bn_to_0xhex(param.orderNote.amount),
4280
- in_asset: bn_to_0xhex(encodeAddress(param.inNote.asset)),
4281
- in_amount: bn_to_0xhex(param.inNote.amount),
4280
+ in_asset: bn_to_0xhex(encodeAddress(param.inAsset)),
4281
+ in_amount: bn_to_0xhex(param.inAmount),
4282
4282
  pub_key: [fuzkPubKeyX.toString(), fuzkPubKeyY.toString()],
4283
4283
  signature: uint8ArrayToNumberArray(signature),
4284
4284
  };
@@ -4312,7 +4312,13 @@ class ProCreateOrderContext extends BaseContext {
4312
4312
  writable: true,
4313
4313
  value: void 0
4314
4314
  });
4315
- Object.defineProperty(this, "_swapInNote", {
4315
+ Object.defineProperty(this, "_swapInAsset", {
4316
+ enumerable: true,
4317
+ configurable: true,
4318
+ writable: true,
4319
+ value: void 0
4320
+ });
4321
+ Object.defineProperty(this, "_swapInAmount", {
4316
4322
  enumerable: true,
4317
4323
  configurable: true,
4318
4324
  writable: true,
@@ -4343,11 +4349,17 @@ class ProCreateOrderContext extends BaseContext {
4343
4349
  get orderNote() {
4344
4350
  return this._orderNote;
4345
4351
  }
4346
- set swapInNote(swapInNote) {
4347
- this._swapInNote = swapInNote;
4352
+ set swapInAsset(swapInAsset) {
4353
+ this._swapInAsset = swapInAsset;
4348
4354
  }
4349
- get swapInNote() {
4350
- return this._swapInNote;
4355
+ get swapInAsset() {
4356
+ return this._swapInAsset;
4357
+ }
4358
+ set swapInAmount(swapInAmount) {
4359
+ this._swapInAmount = swapInAmount;
4360
+ }
4361
+ get swapInAmount() {
4362
+ return this._swapInAmount;
4351
4363
  }
4352
4364
  set oldBalance(oldBalance) {
4353
4365
  this._oldBalance = oldBalance;
@@ -4385,22 +4397,23 @@ class ProCreateOrderService extends BaseContractService {
4385
4397
  super(_darkSwap);
4386
4398
  }
4387
4399
  async prepare(address, orderAsset, orderAmount, swapInAsset, swapInAmount, balanceNote, signature) {
4388
- const [pubKey, privKey] = await generateKeyPair(signature);
4400
+ const [pubKey] = await generateKeyPair(signature);
4389
4401
  const orderNote = createOrderNoteExt(address, orderAsset, orderAmount, FEE_RATIO, pubKey);
4390
4402
  const newBalance = createNote(address, orderAsset, balanceNote.amount - orderAmount, pubKey);
4391
- const swapInNote = createNote(address, swapInAsset, swapInAmount, pubKey);
4392
4403
  const context = new ProCreateOrderContext(signature);
4393
4404
  context.orderNote = orderNote;
4394
- context.swapInNote = swapInNote;
4405
+ context.swapInAsset = swapInAsset;
4406
+ context.swapInAmount = swapInAmount;
4395
4407
  context.oldBalance = balanceNote;
4396
4408
  context.newBalance = newBalance;
4397
4409
  context.address = address;
4398
- return { context, orderNote, swapInNote, newBalance };
4410
+ return { context, orderNote, newBalance };
4399
4411
  }
4400
4412
  async generateProof(context) {
4401
4413
  if (!context
4402
4414
  || !context.orderNote
4403
- || !context.swapInNote
4415
+ || !context.swapInAsset
4416
+ || !context.swapInAmount
4404
4417
  || !context.oldBalance
4405
4418
  || !context.newBalance
4406
4419
  || !context.address
@@ -4415,7 +4428,8 @@ class ProCreateOrderService extends BaseContractService {
4415
4428
  orderNote: context.orderNote,
4416
4429
  oldBalanceNote: context.oldBalance,
4417
4430
  newBalanceNote: context.newBalance,
4418
- inNote: context.swapInNote,
4431
+ inAsset: context.swapInAsset,
4432
+ inAmount: context.swapInAmount,
4419
4433
  address: context.address,
4420
4434
  signedMessage: context.signature,
4421
4435
  });
@@ -4424,7 +4438,13 @@ class ProCreateOrderService extends BaseContractService {
4424
4438
  }
4425
4439
  async execute(context) {
4426
4440
  await this.generateProof(context);
4427
- if (!context || !context.orderNote || !context.swapInNote || !context.oldBalance || !context.newBalance || !context.proof) {
4441
+ if (!context
4442
+ || !context.orderNote
4443
+ || !context.swapInAsset
4444
+ || !context.swapInAmount
4445
+ || !context.oldBalance
4446
+ || !context.newBalance
4447
+ || !context.proof) {
4428
4448
  throw new DarkSwapError('Invalid context');
4429
4449
  }
4430
4450
  const contract = new ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.umd.js CHANGED
@@ -4234,14 +4234,14 @@
4234
4234
  }
4235
4235
  if (param.newBalanceNote.amount < 0n
4236
4236
  || param.oldBalanceNote.amount <= 0n
4237
- || param.inNote.amount <= 0n
4237
+ || param.inAmount <= 0n
4238
4238
  || param.orderNote.amount <= 0n) {
4239
4239
  throw new DarkSwapProofError("Invalid note amount");
4240
4240
  }
4241
4241
  if (param.orderNote.amount != param.oldBalanceNote.amount - param.newBalanceNote.amount) {
4242
4242
  throw new DarkSwapProofError("Invalid order amount");
4243
4243
  }
4244
- const feeAmount = param.inNote.amount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
4244
+ const feeAmount = param.inAmount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
4245
4245
  const [[fuzkPubKeyX, fuzkPubKeyY], fuzkPriKey] = await generateKeyPair(param.signedMessage);
4246
4246
  let newBalanceFooter = EMPTY_FOOTER;
4247
4247
  if (param.oldBalanceNote.amount != 0n) {
@@ -4277,8 +4277,8 @@
4277
4277
  order_note_footer: bn_to_0xhex(orderNoteFooter),
4278
4278
  order_asset: bn_to_0xhex(encodeAddress(param.orderNote.asset)),
4279
4279
  order_amount: bn_to_0xhex(param.orderNote.amount),
4280
- in_asset: bn_to_0xhex(encodeAddress(param.inNote.asset)),
4281
- in_amount: bn_to_0xhex(param.inNote.amount),
4280
+ in_asset: bn_to_0xhex(encodeAddress(param.inAsset)),
4281
+ in_amount: bn_to_0xhex(param.inAmount),
4282
4282
  pub_key: [fuzkPubKeyX.toString(), fuzkPubKeyY.toString()],
4283
4283
  signature: uint8ArrayToNumberArray(signature),
4284
4284
  };
@@ -4312,7 +4312,13 @@
4312
4312
  writable: true,
4313
4313
  value: void 0
4314
4314
  });
4315
- Object.defineProperty(this, "_swapInNote", {
4315
+ Object.defineProperty(this, "_swapInAsset", {
4316
+ enumerable: true,
4317
+ configurable: true,
4318
+ writable: true,
4319
+ value: void 0
4320
+ });
4321
+ Object.defineProperty(this, "_swapInAmount", {
4316
4322
  enumerable: true,
4317
4323
  configurable: true,
4318
4324
  writable: true,
@@ -4343,11 +4349,17 @@
4343
4349
  get orderNote() {
4344
4350
  return this._orderNote;
4345
4351
  }
4346
- set swapInNote(swapInNote) {
4347
- this._swapInNote = swapInNote;
4352
+ set swapInAsset(swapInAsset) {
4353
+ this._swapInAsset = swapInAsset;
4348
4354
  }
4349
- get swapInNote() {
4350
- return this._swapInNote;
4355
+ get swapInAsset() {
4356
+ return this._swapInAsset;
4357
+ }
4358
+ set swapInAmount(swapInAmount) {
4359
+ this._swapInAmount = swapInAmount;
4360
+ }
4361
+ get swapInAmount() {
4362
+ return this._swapInAmount;
4351
4363
  }
4352
4364
  set oldBalance(oldBalance) {
4353
4365
  this._oldBalance = oldBalance;
@@ -4385,22 +4397,23 @@
4385
4397
  super(_darkSwap);
4386
4398
  }
4387
4399
  async prepare(address, orderAsset, orderAmount, swapInAsset, swapInAmount, balanceNote, signature) {
4388
- const [pubKey, privKey] = await generateKeyPair(signature);
4400
+ const [pubKey] = await generateKeyPair(signature);
4389
4401
  const orderNote = createOrderNoteExt(address, orderAsset, orderAmount, FEE_RATIO, pubKey);
4390
4402
  const newBalance = createNote(address, orderAsset, balanceNote.amount - orderAmount, pubKey);
4391
- const swapInNote = createNote(address, swapInAsset, swapInAmount, pubKey);
4392
4403
  const context = new ProCreateOrderContext(signature);
4393
4404
  context.orderNote = orderNote;
4394
- context.swapInNote = swapInNote;
4405
+ context.swapInAsset = swapInAsset;
4406
+ context.swapInAmount = swapInAmount;
4395
4407
  context.oldBalance = balanceNote;
4396
4408
  context.newBalance = newBalance;
4397
4409
  context.address = address;
4398
- return { context, orderNote, swapInNote, newBalance };
4410
+ return { context, orderNote, newBalance };
4399
4411
  }
4400
4412
  async generateProof(context) {
4401
4413
  if (!context
4402
4414
  || !context.orderNote
4403
- || !context.swapInNote
4415
+ || !context.swapInAsset
4416
+ || !context.swapInAmount
4404
4417
  || !context.oldBalance
4405
4418
  || !context.newBalance
4406
4419
  || !context.address
@@ -4415,7 +4428,8 @@
4415
4428
  orderNote: context.orderNote,
4416
4429
  oldBalanceNote: context.oldBalance,
4417
4430
  newBalanceNote: context.newBalance,
4418
- inNote: context.swapInNote,
4431
+ inAsset: context.swapInAsset,
4432
+ inAmount: context.swapInAmount,
4419
4433
  address: context.address,
4420
4434
  signedMessage: context.signature,
4421
4435
  });
@@ -4424,7 +4438,13 @@
4424
4438
  }
4425
4439
  async execute(context) {
4426
4440
  await this.generateProof(context);
4427
- if (!context || !context.orderNote || !context.swapInNote || !context.oldBalance || !context.newBalance || !context.proof) {
4441
+ if (!context
4442
+ || !context.orderNote
4443
+ || !context.swapInAsset
4444
+ || !context.swapInAmount
4445
+ || !context.oldBalance
4446
+ || !context.newBalance
4447
+ || !context.proof) {
4428
4448
  throw new DarkSwapError('Invalid context');
4429
4449
  }
4430
4450
  const contract = new ethers.ethers.Contract(this._darkSwap.contracts.darkSwapAssetManager, DarkSwapAssetManagerAbi.abi, this._darkSwap.signer);
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -6,7 +6,8 @@ export type ProCreateOrderProofParam = BaseProofParam & {
6
6
  oldBalanceNote: DarkSwapNote;
7
7
  newBalanceNote: DarkSwapNote;
8
8
  orderNote: DarkSwapOrderNote;
9
- inNote: DarkSwapNote;
9
+ inAsset: string;
10
+ inAmount: bigint;
10
11
  };
11
12
  export type ProCreateOrderProofResult = BaseProofResult & {
12
13
  oldBalanceNullifier: string;
@@ -6,15 +6,18 @@ declare class ProCreateOrderContext extends BaseContext {
6
6
  private _orderNote?;
7
7
  private _oldBalance?;
8
8
  private _newBalance?;
9
- private _swapInNote?;
9
+ private _swapInAsset?;
10
+ private _swapInAmount?;
10
11
  private _proof?;
11
12
  private _feeAmount?;
12
13
  private _swapMessage?;
13
14
  constructor(signature: string);
14
15
  set orderNote(orderNote: DarkSwapOrderNote | undefined);
15
16
  get orderNote(): DarkSwapOrderNote | undefined;
16
- set swapInNote(swapInNote: DarkSwapNote | undefined);
17
- get swapInNote(): DarkSwapNote | undefined;
17
+ set swapInAsset(swapInAsset: string | undefined);
18
+ get swapInAsset(): string | undefined;
19
+ set swapInAmount(swapInAmount: bigint | undefined);
20
+ get swapInAmount(): bigint | undefined;
18
21
  set oldBalance(oldBalance: DarkSwapNote | undefined);
19
22
  get oldBalance(): DarkSwapNote | undefined;
20
23
  set newBalance(newBalance: DarkSwapNote | undefined);
@@ -31,7 +34,6 @@ export declare class ProCreateOrderService extends BaseContractService {
31
34
  prepare(address: string, orderAsset: string, orderAmount: bigint, swapInAsset: string, swapInAmount: bigint, balanceNote: DarkSwapNote, signature: string): Promise<{
32
35
  context: ProCreateOrderContext;
33
36
  orderNote: DarkSwapOrderNote;
34
- swapInNote: DarkSwapNote;
35
37
  newBalance: DarkSwapNote;
36
38
  }>;
37
39
  private generateProof;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thesingularitynetwork/darkswap-sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "DarkSwap SDK for browser and Node.js",
5
5
  "type": "module",
6
6
  "types": "dist/types/src/index.d.ts",
@@ -47,7 +47,8 @@ export type ProCreateOrderProofParam = BaseProofParam & {
47
47
  oldBalanceNote: DarkSwapNote,
48
48
  newBalanceNote: DarkSwapNote,
49
49
  orderNote: DarkSwapOrderNote,
50
- inNote: DarkSwapNote,
50
+ inAsset: string,
51
+ inAmount: bigint,
51
52
  }
52
53
 
53
54
  export type ProCreateOrderProofResult = BaseProofResult & {
@@ -63,7 +64,7 @@ export async function generateProCreateOrderProof(param: ProCreateOrderProofPara
63
64
 
64
65
  if (param.newBalanceNote.amount < 0n
65
66
  || param.oldBalanceNote.amount <= 0n
66
- || param.inNote.amount <= 0n
67
+ || param.inAmount <= 0n
67
68
  || param.orderNote.amount <= 0n) {
68
69
  throw new DarkSwapProofError("Invalid note amount");
69
70
  }
@@ -72,7 +73,7 @@ export async function generateProCreateOrderProof(param: ProCreateOrderProofPara
72
73
  throw new DarkSwapProofError("Invalid order amount");
73
74
  }
74
75
 
75
- const feeAmount = param.inNote.amount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
76
+ const feeAmount = param.inAmount * param.orderNote.feeRatio / FEE_RATIO_PRECISION;
76
77
 
77
78
  const [[fuzkPubKeyX, fuzkPubKeyY], fuzkPriKey] = await generateKeyPair(param.signedMessage);
78
79
 
@@ -116,8 +117,8 @@ export async function generateProCreateOrderProof(param: ProCreateOrderProofPara
116
117
  order_note_footer: bn_to_0xhex(orderNoteFooter),
117
118
  order_asset: bn_to_0xhex(encodeAddress(param.orderNote.asset)),
118
119
  order_amount: bn_to_0xhex(param.orderNote.amount),
119
- in_asset: bn_to_0xhex(encodeAddress(param.inNote.asset)),
120
- in_amount: bn_to_0xhex(param.inNote.amount),
120
+ in_asset: bn_to_0xhex(encodeAddress(param.inAsset)),
121
+ in_amount: bn_to_0xhex(param.inAmount),
121
122
 
122
123
  pub_key: [fuzkPubKeyX.toString(), fuzkPubKeyY.toString()],
123
124
  signature: uint8ArrayToNumberArray(signature),
@@ -14,7 +14,8 @@ class ProCreateOrderContext extends BaseContext {
14
14
  private _orderNote?: DarkSwapOrderNote;
15
15
  private _oldBalance?: DarkSwapNote;
16
16
  private _newBalance?: DarkSwapNote;
17
- private _swapInNote?: DarkSwapNote;
17
+ private _swapInAsset?: string;
18
+ private _swapInAmount?: bigint;
18
19
  private _proof?: ProCreateOrderProofResult;
19
20
  private _feeAmount?: bigint;
20
21
  private _swapMessage?: DarkSwapMessage;
@@ -31,12 +32,20 @@ class ProCreateOrderContext extends BaseContext {
31
32
  return this._orderNote;
32
33
  }
33
34
 
34
- set swapInNote(swapInNote: DarkSwapNote | undefined) {
35
- this._swapInNote = swapInNote;
35
+ set swapInAsset(swapInAsset: string | undefined) {
36
+ this._swapInAsset = swapInAsset;
36
37
  }
37
38
 
38
- get swapInNote(): DarkSwapNote | undefined {
39
- return this._swapInNote;
39
+ get swapInAsset(): string | undefined {
40
+ return this._swapInAsset;
41
+ }
42
+
43
+ set swapInAmount(swapInAmount: bigint | undefined) {
44
+ this._swapInAmount = swapInAmount;
45
+ }
46
+
47
+ get swapInAmount(): bigint | undefined {
48
+ return this._swapInAmount;
40
49
  }
41
50
 
42
51
  set oldBalance(oldBalance: DarkSwapNote | undefined) {
@@ -93,24 +102,25 @@ export class ProCreateOrderService extends BaseContractService {
93
102
  swapInAmount: bigint,
94
103
  balanceNote: DarkSwapNote,
95
104
  signature: string
96
- ): Promise<{ context: ProCreateOrderContext; orderNote: DarkSwapOrderNote, swapInNote: DarkSwapNote, newBalance: DarkSwapNote }> {
97
- const [pubKey, privKey] = await generateKeyPair(signature);
105
+ ): Promise<{ context: ProCreateOrderContext; orderNote: DarkSwapOrderNote, newBalance: DarkSwapNote }> {
106
+ const [pubKey] = await generateKeyPair(signature);
98
107
  const orderNote = createOrderNoteExt(address, orderAsset, orderAmount, FEE_RATIO, pubKey);
99
108
  const newBalance = createNote(address, orderAsset, balanceNote.amount - orderAmount, pubKey);
100
- const swapInNote = createNote(address, swapInAsset, swapInAmount, pubKey);
101
109
  const context = new ProCreateOrderContext(signature);
102
110
  context.orderNote = orderNote;
103
- context.swapInNote = swapInNote;
111
+ context.swapInAsset = swapInAsset;
112
+ context.swapInAmount = swapInAmount;
104
113
  context.oldBalance = balanceNote;
105
114
  context.newBalance = newBalance;
106
115
  context.address = address;
107
- return { context, orderNote, swapInNote, newBalance };
116
+ return { context, orderNote, newBalance };
108
117
  }
109
118
 
110
119
  private async generateProof(context: ProCreateOrderContext): Promise<void> {
111
120
  if (!context
112
121
  || !context.orderNote
113
- || !context.swapInNote
122
+ || !context.swapInAsset
123
+ || !context.swapInAmount
114
124
  || !context.oldBalance
115
125
  || !context.newBalance
116
126
  || !context.address
@@ -127,7 +137,8 @@ export class ProCreateOrderService extends BaseContractService {
127
137
  orderNote: context.orderNote,
128
138
  oldBalanceNote: context.oldBalance,
129
139
  newBalanceNote: context.newBalance,
130
- inNote: context.swapInNote,
140
+ inAsset: context.swapInAsset,
141
+ inAmount: context.swapInAmount,
131
142
  address: context.address,
132
143
  signedMessage: context.signature,
133
144
  });
@@ -137,7 +148,13 @@ export class ProCreateOrderService extends BaseContractService {
137
148
 
138
149
  public async execute(context: ProCreateOrderContext): Promise<string> {
139
150
  await this.generateProof(context);
140
- if (!context || !context.orderNote || !context.swapInNote || !context.oldBalance || !context.newBalance || !context.proof) {
151
+ if (!context
152
+ || !context.orderNote
153
+ || !context.swapInAsset
154
+ || !context.swapInAmount
155
+ || !context.oldBalance
156
+ || !context.newBalance
157
+ || !context.proof) {
141
158
  throw new DarkSwapError('Invalid context');
142
159
  }
143
160