Skip to content

Commit 6c8d2a3

Browse files
BellringerQuinncaballoninjaandygruening
authored
Feature/marketplace checkout (#209)
* Implement GenerateBuyTransaction endpoint/request support * Added sardine whitelist checking support * Integrate GetSardineSupportedRegions request * Added GetSardineClientToken endpoint support * Basic integration for sardine checkout. Moved CollectibleOrder and dependant classes to the Integrations assembly so that Marketplace assembly can inherrit from Integrations assembly (using Transak and Sardine) * Checkout Options implementation * Implemented support for the remaining marketplace reader API requests * GetCheckoutOptions using Order[] * Added events for reading callbacks and updated tests to make sure they are being hit * Add tests for checking the supported checkout options for a given order array * Generate buy transaction implementation and test * Fixed ListCurrencies implementation such that tests pass * Finish generateBuyTransaction interface and finish writing test * Fix GetCollectible implementation such that tests pass * Rename get collectible listing/offer requests and tests * Rename ListCollectibleListings/Offers to ListListings/Offers-ForCollectibles and add missing tests * Rename ListCollectiblesWithLowestListing/HighestOffer to more descriptive names and fix implementation to new endpoint configuration and update test namings * Remove TransactionGenerator as it was unused and duplicating code * Added GenerateSellTransaction method and test * Fix json construction * Fix GenerateBuy/Sell-Transaction calls such that buy tests pass * Added GenerateListingTransaction and GenerateOfferTransaction implementation and tests * Refactor such that I use a more generic EnumConverter as opposed to creating separate json converters for each enum * Fixed GetCheckoutOptions implementation and test * Added GetFloorOrder implementation * Updated Transak NFT checkout integration - not currently working, I am told I have invalid calldata when opening the link. I am also needing to mock the gas estimation as my estimator thinks the transaction will revert (which makes sense as I wouldn't be executing) * Added Sardine data types * Added SardineGetNFTCheckoutToken integration and test. Cleaner testing interface * Handle gas currency case by checking for currency address = zero address * FirstCommitForQr (#170) * FirstCommitForQr Qr Setup and exposure with link to add funds for the respective order chain id in native token address * More automatization on adding funds Detecting specifics straight from collectible order * Automated inputs for QR Included automated inputs for adding funds via qr transfer link. Fills Qr with selected order Order component information. * Updated qr token address setting Made check for nativetokenaddress placeholder to use in case ChainTokenAddress.Get(),(renamed) and also made some minor ui text updates. * Standarized to EIP-618 transfer link It includes all etheremum eip-618 compatible wallets (metamask is such). Also revisions on price names and formats * Use dev for now * Add preserve compiler tag to constructors that are used by Newtonsoft for json serialization/deserialization so that they don't get striped during builds * Fix broken tests * Rename orderbookKind arg to orderbook * Fixed SardineGetSupportedRegions request and httpclient * Fix broken test * Fix more tests * Fix more tests * Reset session id and session wallet when trying to login not when logged out. Additionally, removed the federate auth methods from the GuestConnector since this flow isn't supported * Fix broken tests * Added basic swap api integration and tests * Use polygon for test * Update currency swap API, the slippage percentage is in percentage not in basis points. GetSwapQuote will now first confirm the user has sufficient funds before swapping; unfulfilled swap quotes lead to Sequence being penalized. Fix broken tests * Throw an exception if we get a null response from API without an error attached * Fix broken tests and add additional tests for the pre validation before sending swap quote request * Fix broken generate listing transaction test implementation * add CreateListingAndBuyIt end to end test * Finish CreateListingAndBuyIt end to end test * fixed stuck in loading screen when a user entered an empty email * Added retry logic to CreateListingAndBuyIt test as the orders are not always refreshed right away which was causing the test to be spotty. The test was still spotty so I added a SeedMarketplace method that can be run to seed the marketplace with 100 offers and 100 listings, this uses a fair amount of credits to run so it should be done sparingly. Added a CreateOfferAndSellIt method that tests the other side of the marketplace. Switched to prod. Fixed GenerateSellTransaction implementation * Fix GenerateBuy/SellTransaction interface to include amount to buy/sell * Fix broken tests. Move marketplace seeding logic to its own class MarketplaceSeeder * Switch currency swap to prod api * Fix test implementation * Rename SeeMarketplaceListingsPage/Panel to ViewMarketplaceListingsPage/Panel so we don't look like we've made typos when having an Open... method. * Added GenerateCancelRequest support and test. Test cleanup * Added default contract to viewMarketplaceListingsPage * Update cancel order test such that I filter my fetch to only include the orders created by my wallet * Added ListAllSellableOffers and ListAllPurchasableListings methods to reader and unit tests * Added IReader interface with intellisence summaries that is implemented by MarketplaceReader. Added some additional unit tests * Added ICheckout interface with intellisence summaries that is implemented by Checkout. Added callback events to Checkout. Added intellisence summaries to FilterAffordableOrders * Extended Step[] such that it is easier to turn these into transactions and submit * Added ISwap interface with intellisence summary implemented by CurrencySwap. Added callback events * Update ViewMarketplacePage such that listings are shown with their prices listed in cryptocurrency (with the associated currency token icon displayed) and available amount * Fetch mock collectible orders for now. Add focus button for marketplace tiles and buy button. Also setup support for token info page * Populate checkout page with CartItems * Fix transition screen UI * increment package version * Fix broken test * Switch to prod * Added Cart and respective tests * Create a cart with a single listing. Return a decorated error message if we fail to fetch a swap price * Fix listings page assembly. Add mising array utils function * Revert "Switch to prod" This reverts commit 1582e50. * Update intellisense summaries and fix broken tests * Build temporary scene to make it easier to update checkout page UI. Add working scrollview to CheckoutPage * Instantiate estimated cost area, network banner, and divider * Instantiate crypto payment options * Checkout setup. Additional CartTests * increment package version * Migrate CheckoutPage to use an ICheckoutHelper interface, implemented by Cart and NftCheckout (the same as Cart but with a max of one collectible in the cart). New dev endpoint. * Get checkout UI working with mocks * Purchase tokens via demo scene * Incrementing or decrementing amount of tokens refreshes UI * Fix broken test * Fix decimal normalizer for large BigInts * Add test for purchasing listing with native currency * Fund account with QR code * Clear spawned items in CheckoutPage when we close so that we don't end up spawning extra stuff on subsequent openings * Added on-ramp button to checkout page, supporting transak * include placeholder image url and name for sardine as these are required * Added intellisense summaries for ICheckoutHelper * Switch tests to using dev env * Rename IReader to IMarketplaceReader * Rename mock * Fix compile error * Cleanup CheckoutPage implementation and make most methods protected to make the class easier to extend * Fix transak nft checkout test * Cleanup - remove code I'm not as confident in and remove Temp scene + scripts --------- Co-authored-by: Tomas Kolakovic <[email protected]> Co-authored-by: Andy Grüning <[email protected]>
1 parent 7ebe426 commit 6c8d2a3

File tree

359 files changed

+23100
-9425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+23100
-9425
lines changed

Assets/GuestLogin/GuestLogin.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ namespace GuestLogin
1010
{
1111
public class GuestLogin : MonoBehaviour
1212
{
13+
[SerializeField] private bool _loginAutomatically = true;
14+
1315
private ILogin _login;
1416
private int _signOuts = 0;
1517
private IWallet _wallet;
@@ -25,7 +27,10 @@ private void Awake()
2527

2628
private void Start()
2729
{
28-
_login.GuestLogin();
30+
if (_loginAutomatically)
31+
{
32+
_login.GuestLogin();
33+
}
2934
}
3035

3136
private void OnWaaSWalletCreated(SequenceWallet wallet)
@@ -58,5 +63,10 @@ private IEnumerator SignOutThenSignBackIn()
5863
_login.GuestLogin();
5964
}
6065
}
66+
67+
public void Login()
68+
{
69+
_login.GuestLogin();
70+
}
6171
}
6272
}

Assets/SequenceFrontend/Scenes/Tests.unity

Lines changed: 289 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
41+
m_IndirectSpecularColor: {r: 0.44657815, g: 0.49641192, b: 0.57481617, a: 1}
4242
m_UseRadianceAmbientProbe: 0
4343
--- !u!157 &3
4444
LightmapSettings:
@@ -576,6 +576,141 @@ RectTransform:
576576
m_CorrespondingSourceObject: {fileID: 8067163605015323919, guid: a5a68ec1b8c3c430694abc1729fc5369, type: 3}
577577
m_PrefabInstance: {fileID: 309099119}
578578
m_PrefabAsset: {fileID: 0}
579+
--- !u!1 &484486286
580+
GameObject:
581+
m_ObjectHideFlags: 0
582+
m_CorrespondingSourceObject: {fileID: 0}
583+
m_PrefabInstance: {fileID: 0}
584+
m_PrefabAsset: {fileID: 0}
585+
serializedVersion: 6
586+
m_Component:
587+
- component: {fileID: 484486287}
588+
- component: {fileID: 484486289}
589+
- component: {fileID: 484486288}
590+
m_Layer: 5
591+
m_Name: Text (TMP)
592+
m_TagString: Untagged
593+
m_Icon: {fileID: 0}
594+
m_NavMeshLayer: 0
595+
m_StaticEditorFlags: 0
596+
m_IsActive: 1
597+
--- !u!224 &484486287
598+
RectTransform:
599+
m_ObjectHideFlags: 0
600+
m_CorrespondingSourceObject: {fileID: 0}
601+
m_PrefabInstance: {fileID: 0}
602+
m_PrefabAsset: {fileID: 0}
603+
m_GameObject: {fileID: 484486286}
604+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
605+
m_LocalPosition: {x: 0, y: 0, z: 0}
606+
m_LocalScale: {x: 1, y: 1, z: 1}
607+
m_ConstrainProportionsScale: 0
608+
m_Children: []
609+
m_Father: {fileID: 1100602928}
610+
m_RootOrder: 0
611+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
612+
m_AnchorMin: {x: 0, y: 0}
613+
m_AnchorMax: {x: 1, y: 1}
614+
m_AnchoredPosition: {x: 0, y: 0}
615+
m_SizeDelta: {x: 0, y: 0}
616+
m_Pivot: {x: 0.5, y: 0.5}
617+
--- !u!114 &484486288
618+
MonoBehaviour:
619+
m_ObjectHideFlags: 0
620+
m_CorrespondingSourceObject: {fileID: 0}
621+
m_PrefabInstance: {fileID: 0}
622+
m_PrefabAsset: {fileID: 0}
623+
m_GameObject: {fileID: 484486286}
624+
m_Enabled: 1
625+
m_EditorHideFlags: 0
626+
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
627+
m_Name:
628+
m_EditorClassIdentifier:
629+
m_Material: {fileID: 0}
630+
m_Color: {r: 1, g: 1, b: 1, a: 1}
631+
m_RaycastTarget: 1
632+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
633+
m_Maskable: 1
634+
m_OnCullStateChanged:
635+
m_PersistentCalls:
636+
m_Calls: []
637+
m_text: Guest
638+
m_isRightToLeft: 0
639+
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
640+
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
641+
m_fontSharedMaterials: []
642+
m_fontMaterial: {fileID: 0}
643+
m_fontMaterials: []
644+
m_fontColor32:
645+
serializedVersion: 2
646+
rgba: 4281479730
647+
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
648+
m_enableVertexGradient: 0
649+
m_colorMode: 3
650+
m_fontColorGradient:
651+
topLeft: {r: 1, g: 1, b: 1, a: 1}
652+
topRight: {r: 1, g: 1, b: 1, a: 1}
653+
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
654+
bottomRight: {r: 1, g: 1, b: 1, a: 1}
655+
m_fontColorGradientPreset: {fileID: 0}
656+
m_spriteAsset: {fileID: 0}
657+
m_tintAllSprites: 0
658+
m_StyleSheet: {fileID: 0}
659+
m_TextStyleHashCode: -1183493901
660+
m_overrideHtmlColors: 0
661+
m_faceColor:
662+
serializedVersion: 2
663+
rgba: 4294967295
664+
m_fontSize: 24
665+
m_fontSizeBase: 24
666+
m_fontWeight: 400
667+
m_enableAutoSizing: 0
668+
m_fontSizeMin: 18
669+
m_fontSizeMax: 72
670+
m_fontStyle: 0
671+
m_HorizontalAlignment: 2
672+
m_VerticalAlignment: 512
673+
m_textAlignment: 65535
674+
m_characterSpacing: 0
675+
m_wordSpacing: 0
676+
m_lineSpacing: 0
677+
m_lineSpacingMax: 0
678+
m_paragraphSpacing: 0
679+
m_charWidthMaxAdj: 0
680+
m_enableWordWrapping: 1
681+
m_wordWrappingRatios: 0.4
682+
m_overflowMode: 0
683+
m_linkedTextComponent: {fileID: 0}
684+
parentLinkedComponent: {fileID: 0}
685+
m_enableKerning: 1
686+
m_enableExtraPadding: 0
687+
checkPaddingRequired: 0
688+
m_isRichText: 1
689+
m_parseCtrlCharacters: 1
690+
m_isOrthographic: 1
691+
m_isCullingEnabled: 0
692+
m_horizontalMapping: 0
693+
m_verticalMapping: 0
694+
m_uvLineOffset: 0
695+
m_geometrySortingOrder: 0
696+
m_IsTextObjectScaleStatic: 0
697+
m_VertexBufferAutoSizeReduction: 0
698+
m_useMaxVisibleDescender: 1
699+
m_pageToDisplay: 1
700+
m_margin: {x: 0, y: 0, z: 0, w: 0}
701+
m_isUsingLegacyAnimationComponent: 0
702+
m_isVolumetricText: 0
703+
m_hasFontAssetChanged: 0
704+
m_baseMaterial: {fileID: 0}
705+
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
706+
--- !u!222 &484486289
707+
CanvasRenderer:
708+
m_ObjectHideFlags: 0
709+
m_CorrespondingSourceObject: {fileID: 0}
710+
m_PrefabInstance: {fileID: 0}
711+
m_PrefabAsset: {fileID: 0}
712+
m_GameObject: {fileID: 484486286}
713+
m_CullTransparentMesh: 1
579714
--- !u!224 &595273815 stripped
580715
RectTransform:
581716
m_CorrespondingSourceObject: {fileID: 2980900696299840490, guid: 7d8e311766e5c4b8693a216ca3708b52, type: 3}
@@ -781,6 +916,154 @@ MonoBehaviour:
781916
_closeAnimationDurationInSeconds: 0
782917
_animation: 0
783918
InitialPage: {fileID: 0}
919+
--- !u!1 &1100602927
920+
GameObject:
921+
m_ObjectHideFlags: 0
922+
m_CorrespondingSourceObject: {fileID: 0}
923+
m_PrefabInstance: {fileID: 0}
924+
m_PrefabAsset: {fileID: 0}
925+
serializedVersion: 6
926+
m_Component:
927+
- component: {fileID: 1100602928}
928+
- component: {fileID: 1100602932}
929+
- component: {fileID: 1100602931}
930+
- component: {fileID: 1100602930}
931+
- component: {fileID: 1100602929}
932+
m_Layer: 5
933+
m_Name: Guest
934+
m_TagString: Untagged
935+
m_Icon: {fileID: 0}
936+
m_NavMeshLayer: 0
937+
m_StaticEditorFlags: 0
938+
m_IsActive: 1
939+
--- !u!224 &1100602928
940+
RectTransform:
941+
m_ObjectHideFlags: 0
942+
m_CorrespondingSourceObject: {fileID: 0}
943+
m_PrefabInstance: {fileID: 0}
944+
m_PrefabAsset: {fileID: 0}
945+
m_GameObject: {fileID: 1100602927}
946+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
947+
m_LocalPosition: {x: 0, y: 0, z: 0}
948+
m_LocalScale: {x: 1, y: 1, z: 1}
949+
m_ConstrainProportionsScale: 0
950+
m_Children:
951+
- {fileID: 484486287}
952+
m_Father: {fileID: 1404552077}
953+
m_RootOrder: 9
954+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
955+
m_AnchorMin: {x: 0.5, y: 0.5}
956+
m_AnchorMax: {x: 0.5, y: 0.5}
957+
m_AnchoredPosition: {x: 0, y: -200.5}
958+
m_SizeDelta: {x: 160, y: 30}
959+
m_Pivot: {x: 0.5, y: 0.5}
960+
--- !u!114 &1100602929
961+
MonoBehaviour:
962+
m_ObjectHideFlags: 0
963+
m_CorrespondingSourceObject: {fileID: 0}
964+
m_PrefabInstance: {fileID: 0}
965+
m_PrefabAsset: {fileID: 0}
966+
m_GameObject: {fileID: 1100602927}
967+
m_Enabled: 1
968+
m_EditorHideFlags: 0
969+
m_Script: {fileID: 11500000, guid: 950b78f19316442a9761372c6f370374, type: 3}
970+
m_Name:
971+
m_EditorClassIdentifier:
972+
_loginAutomatically: 0
973+
--- !u!114 &1100602930
974+
MonoBehaviour:
975+
m_ObjectHideFlags: 0
976+
m_CorrespondingSourceObject: {fileID: 0}
977+
m_PrefabInstance: {fileID: 0}
978+
m_PrefabAsset: {fileID: 0}
979+
m_GameObject: {fileID: 1100602927}
980+
m_Enabled: 1
981+
m_EditorHideFlags: 0
982+
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
983+
m_Name:
984+
m_EditorClassIdentifier:
985+
m_Navigation:
986+
m_Mode: 3
987+
m_WrapAround: 0
988+
m_SelectOnUp: {fileID: 0}
989+
m_SelectOnDown: {fileID: 0}
990+
m_SelectOnLeft: {fileID: 0}
991+
m_SelectOnRight: {fileID: 0}
992+
m_Transition: 1
993+
m_Colors:
994+
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
995+
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
996+
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
997+
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
998+
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
999+
m_ColorMultiplier: 1
1000+
m_FadeDuration: 0.1
1001+
m_SpriteState:
1002+
m_HighlightedSprite: {fileID: 0}
1003+
m_PressedSprite: {fileID: 0}
1004+
m_SelectedSprite: {fileID: 0}
1005+
m_DisabledSprite: {fileID: 0}
1006+
m_AnimationTriggers:
1007+
m_NormalTrigger: Normal
1008+
m_HighlightedTrigger: Highlighted
1009+
m_PressedTrigger: Pressed
1010+
m_SelectedTrigger: Selected
1011+
m_DisabledTrigger: Disabled
1012+
m_Interactable: 1
1013+
m_TargetGraphic: {fileID: 1100602931}
1014+
m_OnClick:
1015+
m_PersistentCalls:
1016+
m_Calls:
1017+
- m_Target: {fileID: 1100602929}
1018+
m_TargetAssemblyTypeName: GuestLogin.GuestLogin, Assembly-CSharp
1019+
m_MethodName: Login
1020+
m_Mode: 1
1021+
m_Arguments:
1022+
m_ObjectArgument: {fileID: 0}
1023+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
1024+
m_IntArgument: 0
1025+
m_FloatArgument: 0
1026+
m_StringArgument:
1027+
m_BoolArgument: 0
1028+
m_CallState: 2
1029+
--- !u!114 &1100602931
1030+
MonoBehaviour:
1031+
m_ObjectHideFlags: 0
1032+
m_CorrespondingSourceObject: {fileID: 0}
1033+
m_PrefabInstance: {fileID: 0}
1034+
m_PrefabAsset: {fileID: 0}
1035+
m_GameObject: {fileID: 1100602927}
1036+
m_Enabled: 1
1037+
m_EditorHideFlags: 0
1038+
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
1039+
m_Name:
1040+
m_EditorClassIdentifier:
1041+
m_Material: {fileID: 0}
1042+
m_Color: {r: 1, g: 1, b: 1, a: 1}
1043+
m_RaycastTarget: 1
1044+
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
1045+
m_Maskable: 1
1046+
m_OnCullStateChanged:
1047+
m_PersistentCalls:
1048+
m_Calls: []
1049+
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
1050+
m_Type: 1
1051+
m_PreserveAspect: 0
1052+
m_FillCenter: 1
1053+
m_FillMethod: 4
1054+
m_FillAmount: 1
1055+
m_FillClockwise: 1
1056+
m_FillOrigin: 0
1057+
m_UseSpriteMesh: 0
1058+
m_PixelsPerUnitMultiplier: 1
1059+
--- !u!222 &1100602932
1060+
CanvasRenderer:
1061+
m_ObjectHideFlags: 0
1062+
m_CorrespondingSourceObject: {fileID: 0}
1063+
m_PrefabInstance: {fileID: 0}
1064+
m_PrefabAsset: {fileID: 0}
1065+
m_GameObject: {fileID: 1100602927}
1066+
m_CullTransparentMesh: 1
7841067
--- !u!1 &1327297838
7851068
GameObject:
7861069
m_ObjectHideFlags: 0
@@ -1211,6 +1494,11 @@ RectTransform:
12111494
m_CorrespondingSourceObject: {fileID: 3911810626490335503, guid: 4f2f5ce343de8447088bc48817965287, type: 3}
12121495
m_PrefabInstance: {fileID: 1404552075}
12131496
m_PrefabAsset: {fileID: 0}
1497+
--- !u!224 &1404552077 stripped
1498+
RectTransform:
1499+
m_CorrespondingSourceObject: {fileID: 3911810628226866637, guid: 4f2f5ce343de8447088bc48817965287, type: 3}
1500+
m_PrefabInstance: {fileID: 1404552075}
1501+
m_PrefabAsset: {fileID: 0}
12141502
--- !u!1 &1995973477
12151503
GameObject:
12161504
m_ObjectHideFlags: 0

Assets/SequenceSDK/Integrations/Tests/Mocks.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)