@turnkey/react-wallet-kit 2.1.1 → 2.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/providers/client/Provider.tsx"],"names":[],"mappings":"AAiIA,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AAwB5E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAM3B,MAAM,kBAAkB,CAAC;AAyD1B;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsgMxD,CAAC"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/providers/client/Provider.tsx"],"names":[],"mappings":"AAiIA,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AAwB5E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAM3B,MAAM,kBAAkB,CAAC;AAyD1B;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAshMxD,CAAC"}
@@ -3547,29 +3547,22 @@ const ClientProvider = ({
3547
3547
  transaction: transaction,
3548
3548
  stampWith
3549
3549
  }) : await (async () => {
3550
+ const ethTx = transaction;
3551
+ // Drop empty/no-op calldata ("0x" or "") so it isn't sent.
3552
+ const cleanData = data => data && data !== "0x" && data !== "" ? data : undefined;
3553
+ // Shared fee/nonce fields, present on both the V1 and V2 intents.
3550
3554
  const {
3551
3555
  from,
3552
- to,
3553
- value,
3554
- data,
3556
+ sponsor,
3555
3557
  nonce,
3556
3558
  gasLimit,
3557
3559
  maxFeePerGas,
3558
- maxPriorityFeePerGas,
3559
- sponsor
3560
- } = transaction;
3561
- const cleanedData = data && data !== "0x" && data !== "" ? data : undefined;
3562
- const tx = {
3560
+ maxPriorityFeePerGas
3561
+ } = ethTx;
3562
+ const commonFields = {
3563
3563
  from,
3564
- to,
3565
- caip2: caip2,
3564
+ caip2: ethTx.caip2,
3566
3565
  sponsor: sponsor ?? false,
3567
- ...(value ? {
3568
- value
3569
- } : {}),
3570
- ...(cleanedData ? {
3571
- data: cleanedData
3572
- } : {}),
3573
3566
  ...(nonce ? {
3574
3567
  nonce
3575
3568
  } : {}),
@@ -3583,6 +3576,42 @@ const ClientProvider = ({
3583
3576
  maxPriorityFeePerGas
3584
3577
  } : {})
3585
3578
  };
3579
+ // V2 multi-call intent vs. legacy single-call (V1) intent.
3580
+ // TODO (breaking change): eventually, we wont generate the v1 activity at all, remove this check and update the intent.
3581
+ let tx;
3582
+ if ("calls" in ethTx) {
3583
+ tx = {
3584
+ ...commonFields,
3585
+ calls: ethTx.calls.map(({
3586
+ to,
3587
+ value,
3588
+ data
3589
+ }) => {
3590
+ const cleanedData = cleanData(data);
3591
+ return {
3592
+ to,
3593
+ ...(value ? {
3594
+ value
3595
+ } : {}),
3596
+ ...(cleanedData ? {
3597
+ data: cleanedData
3598
+ } : {})
3599
+ };
3600
+ })
3601
+ };
3602
+ } else {
3603
+ const cleanedData = cleanData(ethTx.data);
3604
+ tx = {
3605
+ ...commonFields,
3606
+ to: ethTx.to,
3607
+ ...(ethTx.value ? {
3608
+ value: ethTx.value
3609
+ } : {}),
3610
+ ...(cleanedData ? {
3611
+ data: cleanedData
3612
+ } : {})
3613
+ };
3614
+ }
3586
3615
  return ethSendTransaction({
3587
3616
  organizationId,
3588
3617
  transaction: tx,