thirdweb 5.64.0 → 5.64.2

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.
Files changed (107) hide show
  1. package/dist/cjs/auth/core/generate-login-payload.js +1 -1
  2. package/dist/cjs/auth/core/generate-login-payload.js.map +1 -1
  3. package/dist/cjs/extensions/prebuilts/deploy-vote.js +13 -13
  4. package/dist/cjs/extensions/prebuilts/deploy-vote.js.map +1 -1
  5. package/dist/cjs/react/core/utils/walletIcon.js +7 -7
  6. package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
  7. package/dist/cjs/react/web/ui/ConnectWallet/MenuButton.js +0 -3
  8. package/dist/cjs/react/web/ui/ConnectWallet/MenuButton.js.map +1 -1
  9. package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
  10. package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
  11. package/dist/cjs/react/web/ui/ConnectWallet/WalletTypeRowButton.js +1 -4
  12. package/dist/cjs/react/web/ui/ConnectWallet/WalletTypeRowButton.js.map +1 -1
  13. package/dist/cjs/react/web/ui/ConnectWallet/icons/EmailIcon.js +12 -0
  14. package/dist/cjs/react/web/ui/ConnectWallet/icons/EmailIcon.js.map +1 -0
  15. package/dist/cjs/react/web/ui/ConnectWallet/icons/FingerPrintIcon.js +1 -1
  16. package/dist/cjs/react/web/ui/ConnectWallet/icons/FingerPrintIcon.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/icons/GuestIcon.js +12 -0
  18. package/dist/cjs/react/web/ui/ConnectWallet/icons/GuestIcon.js.map +1 -0
  19. package/dist/cjs/react/web/ui/ConnectWallet/icons/OutlineWalletIcon.js +1 -1
  20. package/dist/cjs/react/web/ui/ConnectWallet/icons/OutlineWalletIcon.js.map +1 -1
  21. package/dist/cjs/react/web/ui/ConnectWallet/icons/PhoneIcon.js +12 -0
  22. package/dist/cjs/react/web/ui/ConnectWallet/icons/PhoneIcon.js.map +1 -0
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +5 -2
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
  25. package/dist/cjs/react/web/ui/components/WalletImage.js +34 -9
  26. package/dist/cjs/react/web/ui/components/WalletImage.js.map +1 -1
  27. package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +9 -2
  28. package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
  29. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +11 -6
  30. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/esm/auth/core/generate-login-payload.js +1 -1
  33. package/dist/esm/auth/core/generate-login-payload.js.map +1 -1
  34. package/dist/esm/extensions/prebuilts/deploy-vote.js +13 -13
  35. package/dist/esm/extensions/prebuilts/deploy-vote.js.map +1 -1
  36. package/dist/esm/react/core/utils/walletIcon.js +3 -3
  37. package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
  38. package/dist/esm/react/web/ui/ConnectWallet/MenuButton.js +0 -3
  39. package/dist/esm/react/web/ui/ConnectWallet/MenuButton.js.map +1 -1
  40. package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
  41. package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
  42. package/dist/esm/react/web/ui/ConnectWallet/WalletTypeRowButton.js +2 -5
  43. package/dist/esm/react/web/ui/ConnectWallet/WalletTypeRowButton.js.map +1 -1
  44. package/dist/esm/react/web/ui/ConnectWallet/icons/EmailIcon.js +8 -0
  45. package/dist/esm/react/web/ui/ConnectWallet/icons/EmailIcon.js.map +1 -0
  46. package/dist/esm/react/web/ui/ConnectWallet/icons/FingerPrintIcon.js +1 -1
  47. package/dist/esm/react/web/ui/ConnectWallet/icons/FingerPrintIcon.js.map +1 -1
  48. package/dist/esm/react/web/ui/ConnectWallet/icons/GuestIcon.js +8 -0
  49. package/dist/esm/react/web/ui/ConnectWallet/icons/GuestIcon.js.map +1 -0
  50. package/dist/esm/react/web/ui/ConnectWallet/icons/OutlineWalletIcon.js +1 -1
  51. package/dist/esm/react/web/ui/ConnectWallet/icons/OutlineWalletIcon.js.map +1 -1
  52. package/dist/esm/react/web/ui/ConnectWallet/icons/PhoneIcon.js +8 -0
  53. package/dist/esm/react/web/ui/ConnectWallet/icons/PhoneIcon.js.map +1 -0
  54. package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js +5 -2
  55. package/dist/esm/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.js.map +1 -1
  56. package/dist/esm/react/web/ui/components/WalletImage.js +34 -9
  57. package/dist/esm/react/web/ui/components/WalletImage.js.map +1 -1
  58. package/dist/esm/react/web/wallets/in-app/WalletAuth.js +9 -2
  59. package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
  60. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +12 -7
  61. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  62. package/dist/esm/version.js +1 -1
  63. package/dist/types/react/core/utils/walletIcon.d.ts +0 -3
  64. package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
  65. package/dist/types/react/web/ui/ConnectWallet/MenuButton.d.ts.map +1 -1
  66. package/dist/types/react/web/ui/ConnectWallet/WalletTypeRowButton.d.ts +2 -1
  67. package/dist/types/react/web/ui/ConnectWallet/WalletTypeRowButton.d.ts.map +1 -1
  68. package/dist/types/react/web/ui/ConnectWallet/icons/EmailIcon.d.ts +6 -0
  69. package/dist/types/react/web/ui/ConnectWallet/icons/EmailIcon.d.ts.map +1 -0
  70. package/dist/types/react/web/ui/ConnectWallet/icons/GuestIcon.d.ts +6 -0
  71. package/dist/types/react/web/ui/ConnectWallet/icons/GuestIcon.d.ts.map +1 -0
  72. package/dist/types/react/web/ui/ConnectWallet/icons/PhoneIcon.d.ts +6 -0
  73. package/dist/types/react/web/ui/ConnectWallet/icons/PhoneIcon.d.ts.map +1 -0
  74. package/dist/types/react/web/ui/ConnectWallet/icons/types.d.ts +1 -0
  75. package/dist/types/react/web/ui/ConnectWallet/icons/types.d.ts.map +1 -1
  76. package/dist/types/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.d.ts.map +1 -1
  77. package/dist/types/react/web/ui/components/WalletImage.d.ts.map +1 -1
  78. package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
  79. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
  80. package/dist/types/version.d.ts +1 -1
  81. package/package.json +1 -1
  82. package/src/auth/core/generate-login-payload.test.ts +1 -1
  83. package/src/auth/core/generate-login-payload.ts +1 -1
  84. package/src/extensions/prebuilts/deploy-vote.test.ts +1 -46
  85. package/src/extensions/prebuilts/deploy-vote.ts +21 -20
  86. package/src/extensions/split/split.test.ts +76 -0
  87. package/src/extensions/vote/{read/proposalExists.test.ts → vote.test.ts} +21 -52
  88. package/src/react/core/utils/walletIcon.ts +3 -3
  89. package/src/react/web/ui/ConnectWallet/MenuButton.tsx +0 -3
  90. package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +2 -2
  91. package/src/react/web/ui/ConnectWallet/WalletTypeRowButton.tsx +4 -17
  92. package/src/react/web/ui/ConnectWallet/icons/EmailIcon.tsx +30 -0
  93. package/src/react/web/ui/ConnectWallet/icons/FingerPrintIcon.tsx +9 -9
  94. package/src/react/web/ui/ConnectWallet/icons/GuestIcon.tsx +24 -0
  95. package/src/react/web/ui/ConnectWallet/icons/OutlineWalletIcon.tsx +2 -2
  96. package/src/react/web/ui/ConnectWallet/icons/PhoneIcon.tsx +32 -0
  97. package/src/react/web/ui/ConnectWallet/icons/types.ts +1 -1
  98. package/src/react/web/ui/ConnectWallet/screens/LinkedProfilesScreen.tsx +10 -1
  99. package/src/react/web/ui/components/WalletImage.tsx +48 -21
  100. package/src/react/web/wallets/in-app/WalletAuth.tsx +14 -2
  101. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +12 -13
  102. package/src/version.ts +1 -1
  103. package/src/wallets/smart/smart-wallet-integration.test.ts +11 -8
  104. package/src/extensions/prebuilts/deploy-split.test.ts +0 -31
  105. package/src/extensions/split/read/getAllRecipientsAddresses.test.ts +0 -41
  106. package/src/extensions/split/read/getAllRecipientsPercentages.test.ts +0 -50
  107. package/src/extensions/split/read/getRecipientSplitPercentage.test.ts +0 -49
@@ -4,7 +4,9 @@ import type { ThirdwebClient } from "../../../../client/client.js";
4
4
  import { webLocalStorage } from "../../../../utils/storage/webStorage.js";
5
5
  import { getWalletInfo } from "../../../../wallets/__generated__/getWalletInfo.js";
6
6
  import { getInstalledWalletProviders } from "../../../../wallets/injected/mipdStore.js";
7
+ import type { AuthOption } from "../../../../wallets/types.js";
7
8
  import type { WalletId } from "../../../../wallets/wallet-types.js";
9
+ import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js";
8
10
  import { radius } from "../../../core/design-system/index.js";
9
11
  import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js";
10
12
  import { getLastAuthProvider } from "../../../core/utils/storage.js";
@@ -13,8 +15,15 @@ import {
13
15
  genericWalletIcon,
14
16
  getSocialIcon,
15
17
  } from "../../../core/utils/walletIcon.js";
18
+ import { EmailIcon } from "../ConnectWallet/icons/EmailIcon.js";
19
+ import { FingerPrintIcon } from "../ConnectWallet/icons/FingerPrintIcon.js";
20
+ import { GuestIcon } from "../ConnectWallet/icons/GuestIcon.js";
21
+ import { OutlineWalletIcon } from "../ConnectWallet/icons/OutlineWalletIcon.js";
22
+ import { PhoneIcon } from "../ConnectWallet/icons/PhoneIcon.js";
16
23
  import { Img } from "./Img.js";
17
24
 
25
+ type WalletImageState = { uri: string; authProvider?: AuthOption };
26
+
18
27
  /**
19
28
  * @internal
20
29
  */
@@ -24,7 +33,8 @@ export function WalletImage(props: {
24
33
  client: ThirdwebClient;
25
34
  style?: React.CSSProperties;
26
35
  }) {
27
- const [image, setImage] = useState<string | undefined>(undefined);
36
+ const theme = useCustomTheme();
37
+ const [image, setImage] = useState<WalletImageState | undefined>(undefined);
28
38
  const activeWallet = useActiveWallet();
29
39
  useEffect(() => {
30
40
  async function fetchImage() {
@@ -33,7 +43,7 @@ export function WalletImage(props: {
33
43
  // show the admin EOA icon for smart
34
44
  const storage = webLocalStorage;
35
45
  const activeEOAId = props.id;
36
- let image: string | undefined;
46
+ let image: WalletImageState | undefined;
37
47
 
38
48
  if (
39
49
  activeEOAId === "inApp" &&
@@ -43,17 +53,22 @@ export function WalletImage(props: {
43
53
  // when showing an active wallet icon - check last auth provider and override the IAW icon
44
54
  const lastAuthProvider = await getLastAuthProvider(storage);
45
55
  image = lastAuthProvider
46
- ? getSocialIcon(lastAuthProvider)
47
- : genericWalletIcon;
56
+ ? {
57
+ uri: getSocialIcon(lastAuthProvider),
58
+ authProvider: lastAuthProvider as AuthOption,
59
+ }
60
+ : { uri: "", authProvider: "wallet" };
48
61
  } else {
49
62
  const mipdImage = getInstalledWalletProviders().find(
50
63
  (x) => x.info.rdns === activeEOAId,
51
64
  )?.info.icon;
52
65
 
53
66
  if (mipdImage) {
54
- image = mipdImage;
67
+ image = { uri: mipdImage };
55
68
  } else {
56
- image = await getWalletInfo(activeEOAId, true);
69
+ image = {
70
+ uri: await getWalletInfo(activeEOAId, true),
71
+ };
57
72
  }
58
73
  }
59
74
 
@@ -62,10 +77,34 @@ export function WalletImage(props: {
62
77
  fetchImage();
63
78
  }, [props.id, activeWallet]);
64
79
 
65
- if (image) {
80
+ if (image?.authProvider === "email") {
81
+ return <EmailIcon size={props.size} color={theme.colors.accentText} />;
82
+ }
83
+
84
+ if (image?.authProvider === "phone") {
85
+ return <PhoneIcon size={props.size} color={theme.colors.accentText} />;
86
+ }
87
+
88
+ if (image?.authProvider === "passkey") {
89
+ return (
90
+ <FingerPrintIcon size={props.size} color={theme.colors.accentText} />
91
+ );
92
+ }
93
+
94
+ if (image?.authProvider === "wallet") {
95
+ return (
96
+ <OutlineWalletIcon size={props.size} color={theme.colors.accentText} />
97
+ );
98
+ }
99
+
100
+ if (image?.authProvider === "guest") {
101
+ return <GuestIcon size={props.size} color={theme.colors.accentText} />;
102
+ }
103
+
104
+ if (image?.uri) {
66
105
  return (
67
106
  <Img
68
- src={image}
107
+ src={image.uri}
69
108
  width={props.size}
70
109
  height={props.size}
71
110
  loading="eager"
@@ -101,17 +140,5 @@ function WalletImageQuery(props: {
101
140
  );
102
141
  }
103
142
 
104
- return (
105
- <Img
106
- client={props.client}
107
- src={walletImage.isLoading ? undefined : walletImage.data}
108
- fallbackImage={genericWalletIcon}
109
- width={props.size}
110
- height={props.size}
111
- loading="eager"
112
- style={{
113
- borderRadius: radius.md,
114
- }}
115
- />
116
- );
143
+ return <OutlineWalletIcon size={props.size} />;
117
144
  }
@@ -131,7 +131,12 @@ export function WalletAuth(props: {
131
131
  size={props.size}
132
132
  meta={props.meta || {}}
133
133
  walletConnect={props.walletConnect}
134
- modalHeader={{ title: props.inAppLocale.linkWallet, onBack: back }}
134
+ modalHeader={{
135
+ title: props.isLinking
136
+ ? props.inAppLocale.linkWallet
137
+ : props.inAppLocale.signInWithWallet,
138
+ onBack: back,
139
+ }}
135
140
  walletIdsToHide={["inApp"]}
136
141
  disableSelectionDataReset={true}
137
142
  />
@@ -141,7 +146,14 @@ export function WalletAuth(props: {
141
146
  return (
142
147
  <Container animate="fadein" fullHeight flex="column">
143
148
  <Container p="lg">
144
- <ModalHeader title={props.inAppLocale.linkWallet} onBack={back} />
149
+ <ModalHeader
150
+ title={
151
+ props.isLinking
152
+ ? props.inAppLocale.linkWallet
153
+ : props.inAppLocale.signInWithWallet
154
+ }
155
+ onBack={back}
156
+ />
145
157
  </Container>
146
158
 
147
159
  <Container
@@ -24,15 +24,14 @@ import {
24
24
  spacing,
25
25
  } from "../../../core/design-system/index.js";
26
26
  import { setLastAuthProvider } from "../../../core/utils/storage.js";
27
- import {
28
- emailIcon,
29
- getSocialIcon,
30
- passkeyIcon,
31
- phoneIcon,
32
- socialIcons,
33
- } from "../../../core/utils/walletIcon.js";
27
+ import { socialIcons } from "../../../core/utils/walletIcon.js";
34
28
  import { useSetSelectionData } from "../../providers/wallet-ui-states-provider.js";
35
29
  import { WalletTypeRowButton } from "../../ui/ConnectWallet/WalletTypeRowButton.js";
30
+ import { EmailIcon } from "../../ui/ConnectWallet/icons/EmailIcon.js";
31
+ import { FingerPrintIcon } from "../../ui/ConnectWallet/icons/FingerPrintIcon.js";
32
+ import { GuestIcon } from "../../ui/ConnectWallet/icons/GuestIcon.js";
33
+ import { OutlineWalletIcon } from "../../ui/ConnectWallet/icons/OutlineWalletIcon.js";
34
+ import { PhoneIcon } from "../../ui/ConnectWallet/icons/PhoneIcon.js";
36
35
  import { Img } from "../../ui/components/Img.js";
37
36
  import { Spacer } from "../../ui/components/Spacer.js";
38
37
  import { TextDivider } from "../../ui/components/TextDivider.js";
@@ -413,7 +412,7 @@ export const ConnectWalletSocialOptions = (
413
412
  ) : (
414
413
  <WalletTypeRowButton
415
414
  client={props.client}
416
- icon={emailIcon}
415
+ icon={EmailIcon}
417
416
  onClick={() => {
418
417
  setManualInputMode("email");
419
418
  }}
@@ -451,7 +450,7 @@ export const ConnectWalletSocialOptions = (
451
450
  ) : (
452
451
  <WalletTypeRowButton
453
452
  client={props.client}
454
- icon={phoneIcon}
453
+ icon={PhoneIcon}
455
454
  onClick={() => {
456
455
  setManualInputMode("phone");
457
456
  }}
@@ -463,7 +462,7 @@ export const ConnectWalletSocialOptions = (
463
462
  {passKeyEnabled && (
464
463
  <WalletTypeRowButton
465
464
  client={props.client}
466
- icon={passkeyIcon}
465
+ icon={FingerPrintIcon}
467
466
  onClick={() => {
468
467
  handlePassKeyLogin();
469
468
  }}
@@ -476,7 +475,7 @@ export const ConnectWalletSocialOptions = (
476
475
  {siweEnabled && (
477
476
  <WalletTypeRowButton
478
477
  client={props.client}
479
- icon={getSocialIcon("")}
478
+ icon={OutlineWalletIcon}
480
479
  onClick={() => {
481
480
  handleWalletLogin();
482
481
  }}
@@ -488,7 +487,7 @@ export const ConnectWalletSocialOptions = (
488
487
  {guestEnabled && (
489
488
  <WalletTypeRowButton
490
489
  client={props.client}
491
- icon={getSocialIcon("guest")}
490
+ icon={GuestIcon}
492
491
  onClick={() => {
493
492
  handleGuestLogin();
494
493
  }}
@@ -500,7 +499,7 @@ export const ConnectWalletSocialOptions = (
500
499
  {props.isLinking && (
501
500
  <WalletTypeRowButton
502
501
  client={props.client}
503
- icon={getSocialIcon("")}
502
+ icon={OutlineWalletIcon}
504
503
  onClick={() => {
505
504
  handleWalletLogin();
506
505
  }}
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.64.0";
1
+ export const version = "5.64.2";
@@ -20,6 +20,7 @@ import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-co
20
20
  import { sendBatchTransaction } from "../../transaction/actions/send-batch-transaction.js";
21
21
  import { waitForReceipt } from "../../transaction/actions/wait-for-tx-receipt.js";
22
22
  import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
23
+ import { sleep } from "../../utils/sleep.js";
23
24
  import type { Account, Wallet } from "../interfaces/wallet.js";
24
25
  import { generateAccount } from "../utils/generateAccount.js";
25
26
  import { smartWallet } from "./smart-wallet.js";
@@ -332,15 +333,17 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
332
333
  }),
333
334
  account: newSmartAccount,
334
335
  }),
335
- sendAndConfirmTransaction({
336
- transaction: claimTo({
337
- contract,
338
- quantity: 1n,
339
- to: newSmartAccount.address,
340
- tokenId: 0n,
336
+ sleep(1000).then(() =>
337
+ sendAndConfirmTransaction({
338
+ transaction: claimTo({
339
+ contract,
340
+ quantity: 1n,
341
+ to: newSmartAccount.address,
342
+ tokenId: 0n,
343
+ }),
344
+ account: newSmartAccount,
341
345
  }),
342
- account: newSmartAccount,
343
- }),
346
+ ),
344
347
  ]);
345
348
  expect(txs.length).toEqual(2);
346
349
  expect(txs.every((t) => t.transactionHash.length === 66)).toBe(true);
@@ -1,31 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { ANVIL_CHAIN } from "~test/chains.js";
3
- import { TEST_CLIENT } from "~test/test-clients.js";
4
- import { TEST_ACCOUNT_D } from "~test/test-wallets.js";
5
- import { isAddress } from "../../utils/address.js";
6
- import { deploySplitContract } from "./deploy-split.js";
7
-
8
- describe.runIf(process.env.TW_SECRET_KEY)("deploy-split contract", () => {
9
- it("should deploy Split contract", async () => {
10
- const address = await deploySplitContract({
11
- account: TEST_ACCOUNT_D,
12
- client: TEST_CLIENT,
13
- chain: ANVIL_CHAIN,
14
- params: {
15
- name: "split-contract",
16
- payees: [
17
- "0x12345674b599ce99958242b3D3741e7b01841DF3",
18
- "0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
19
- ],
20
- shares: [
21
- 5100n, // 51%
22
- 4900n, // 49%
23
- ],
24
- },
25
- });
26
- expect(address).toBeDefined();
27
- expect(isAddress(address)).toBe(true);
28
- // Further tests to verify the functionality of this contract
29
- // are done in other Split tests
30
- });
31
- });
@@ -1,41 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { ANVIL_CHAIN } from "~test/chains.js";
3
- import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
4
- import { TEST_CLIENT } from "~test/test-clients.js";
5
- import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
6
- import { getContract } from "../../../contract/contract.js";
7
- import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
8
- import { getAllRecipientsAddresses } from "./getAllRecipientsAddresses.js";
9
-
10
- const chain = ANVIL_CHAIN;
11
- const client = TEST_CLIENT;
12
-
13
- describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsAddresses", () => {
14
- it("should work", async () => {
15
- const payees = [
16
- "0x12345674b599ce99958242b3D3741e7b01841DF3",
17
- "0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
18
- ];
19
- const address = await deploySplitContract({
20
- account: TEST_ACCOUNT_C,
21
- client: TEST_CLIENT,
22
- chain: ANVIL_CHAIN,
23
- params: {
24
- name: "split-contract",
25
- contractURI: TEST_CONTRACT_URI, // just to speed up the test
26
- payees,
27
- shares: [
28
- 5100n, // 51%
29
- 4900n, // 49%
30
- ],
31
- },
32
- });
33
- const contract = getContract({
34
- address,
35
- chain,
36
- client,
37
- });
38
- const result = await getAllRecipientsAddresses({ contract });
39
- expect(result).toStrictEqual(payees);
40
- });
41
- });
@@ -1,50 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { ANVIL_CHAIN } from "~test/chains.js";
3
- import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
4
- import { TEST_CLIENT } from "~test/test-clients.js";
5
- import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
6
- import { getContract } from "../../../contract/contract.js";
7
- import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
8
- import { getAllRecipientsPercentages } from "./getAllRecipientsPercentages.js";
9
-
10
- const chain = ANVIL_CHAIN;
11
- const client = TEST_CLIENT;
12
-
13
- describe.runIf(process.env.TW_SECRET_KEY)("getAllRecipientsPercentages", () => {
14
- it("should work", async () => {
15
- const payees = [
16
- "0x12345674b599ce99958242b3D3741e7b01841DF3",
17
- "0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
18
- ];
19
- const address = await deploySplitContract({
20
- account: TEST_ACCOUNT_C,
21
- client: TEST_CLIENT,
22
- chain: ANVIL_CHAIN,
23
- params: {
24
- name: "split-contract",
25
- contractURI: TEST_CONTRACT_URI, // just to speed up the test
26
- payees,
27
- shares: [
28
- 5100n, // 51%
29
- 4900n, // 49%
30
- ],
31
- },
32
- });
33
- const contract = getContract({
34
- address,
35
- chain,
36
- client,
37
- });
38
- const result = await getAllRecipientsPercentages({ contract });
39
- expect(result).toStrictEqual([
40
- {
41
- address: "0x12345674b599ce99958242b3D3741e7b01841DF3",
42
- splitPercentage: 51,
43
- },
44
- {
45
- address: "0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
46
- splitPercentage: 49,
47
- },
48
- ]);
49
- });
50
- });
@@ -1,49 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { ANVIL_CHAIN } from "~test/chains.js";
3
- import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
4
- import { TEST_CLIENT } from "~test/test-clients.js";
5
- import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
6
- import { getContract } from "../../../contract/contract.js";
7
- import { deploySplitContract } from "../../../extensions/prebuilts/deploy-split.js";
8
- import { getRecipientSplitPercentage } from "./getRecipientSplitPercentage.js";
9
-
10
- const chain = ANVIL_CHAIN;
11
- const client = TEST_CLIENT;
12
- const account = TEST_ACCOUNT_C;
13
-
14
- describe.runIf(process.env.TW_SECRET_KEY)("getRecipientSplitPercentage", () => {
15
- it("should work", async () => {
16
- const payees = [
17
- "0x12345674b599ce99958242b3D3741e7b01841DF3",
18
- "0xA6f11e47dE28B3dB934e945daeb6F538E9019694",
19
- ];
20
- const address = await deploySplitContract({
21
- account,
22
- client: TEST_CLIENT,
23
- chain: ANVIL_CHAIN,
24
- params: {
25
- name: "split-contract",
26
- contractURI: TEST_CONTRACT_URI, // just to speed up the test
27
- payees,
28
- shares: [
29
- 5100n, // 51%
30
- 4900n, // 49%
31
- ],
32
- },
33
- });
34
- const contract = getContract({
35
- address,
36
- chain,
37
- client,
38
- });
39
- const result = await getRecipientSplitPercentage({
40
- contract,
41
- recipientAddress: "0x12345674b599ce99958242b3D3741e7b01841DF3",
42
- });
43
-
44
- expect(result).toStrictEqual({
45
- address: "0x12345674b599ce99958242b3D3741e7b01841DF3",
46
- splitPercentage: 51,
47
- });
48
- });
49
- });