diff --git a/sample/Assets/Scenes/AuthenticatedScene.unity b/sample/Assets/Scenes/AuthenticatedScene.unity index dc139a01..669c9dce 100644 --- a/sample/Assets/Scenes/AuthenticatedScene.unity +++ b/sample/Assets/Scenes/AuthenticatedScene.unity @@ -156,7 +156,7 @@ RectTransform: m_Children: - {fileID: 2078189342} m_Father: {fileID: 582652582} - m_RootOrder: 17 + m_RootOrder: 18 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -388,7 +388,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 582652582} - m_RootOrder: 14 + m_RootOrder: 15 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -631,7 +631,7 @@ RectTransform: - {fileID: 1879927324} - {fileID: 29599245} m_Father: {fileID: 582652582} - m_RootOrder: 12 + m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -2242,6 +2242,106 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 406311235} m_CullTransparentMesh: 1 +--- !u!1 &409290998 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 409290999} + - component: {fileID: 409291002} + - component: {fileID: 409291001} + - component: {fileID: 409291000} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &409290999 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409290998} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1190400631} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &409291000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409290998} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &409291001 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409290998} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &409291002 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409290998} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 --- !u!1 &428937610 GameObject: m_ObjectHideFlags: 0 @@ -2914,7 +3014,7 @@ RectTransform: - {fileID: 471675801} - {fileID: 428937611} m_Father: {fileID: 582652582} - m_RootOrder: 9 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -3477,6 +3577,7 @@ RectTransform: - {fileID: 233216474} - {fileID: 701664304} - {fileID: 1744645923} + - {fileID: 1190400631} - {fileID: 1341903194} - {fileID: 1701333158} - {fileID: 1974284045} @@ -4035,6 +4136,86 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 663560011} m_CullTransparentMesh: 1 +--- !u!1 &687306520 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 687306521} + - component: {fileID: 687306523} + - component: {fileID: 687306522} + m_Layer: 5 + m_Name: Text (Legacy) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &687306521 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 687306520} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1190400631} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &687306522 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 687306520} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Get Linked Addresses +--- !u!222 &687306523 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 687306520} + m_CullTransparentMesh: 1 --- !u!1 &701664303 GameObject: m_ObjectHideFlags: 0 @@ -5306,7 +5487,7 @@ RectTransform: m_Children: - {fileID: 1521624799} m_Father: {fileID: 582652582} - m_RootOrder: 19 + m_RootOrder: 20 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -5902,7 +6083,7 @@ RectTransform: m_Children: - {fileID: 143607578} m_Father: {fileID: 582652582} - m_RootOrder: 18 + m_RootOrder: 19 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -7309,7 +7490,7 @@ RectTransform: m_Children: - {fileID: 2144491564} m_Father: {fileID: 582652582} - m_RootOrder: 15 + m_RootOrder: 16 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -7650,6 +7831,141 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1174767622} m_CullTransparentMesh: 1 +--- !u!1 &1190400630 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1190400631} + - component: {fileID: 1190400634} + - component: {fileID: 1190400633} + - component: {fileID: 1190400632} + m_Layer: 5 + m_Name: GetLinkedAddresses + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1190400631 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1190400630} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 687306521} + - {fileID: 409290999} + m_Father: {fileID: 582652582} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 921, y: -76.999985} + m_SizeDelta: {x: 150, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1190400632 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1190400630} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1190400633} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1192763474} + m_TargetAssemblyTypeName: AuthenticatedScript, Assembly-CSharp + m_MethodName: GetLinkedAddresses + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &1190400633 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1190400630} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1190400634 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1190400630} + m_CullTransparentMesh: 1 --- !u!1 &1192763471 GameObject: m_ObjectHideFlags: 0 @@ -8446,11 +8762,11 @@ RectTransform: - {fileID: 178301016} - {fileID: 1130062893} m_Father: {fileID: 582652582} - m_RootOrder: 6 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 921, y: -77} + m_AnchoredPosition: {x: 1087, y: -77} m_SizeDelta: {x: 150, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1343113121 @@ -8844,7 +9160,7 @@ RectTransform: - {fileID: 507797917} - {fileID: 1563479608} m_Father: {fileID: 582652582} - m_RootOrder: 11 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -10377,7 +10693,7 @@ RectTransform: - {fileID: 1904228988} - {fileID: 2065926701} m_Father: {fileID: 582652582} - m_RootOrder: 10 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -10839,7 +11155,7 @@ RectTransform: - {fileID: 723321858} - {fileID: 957855162} m_Father: {fileID: 582652582} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -12248,7 +12564,7 @@ RectTransform: m_Children: - {fileID: 1940024843} m_Father: {fileID: 582652582} - m_RootOrder: 16 + m_RootOrder: 17 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -12821,7 +13137,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 582652582} - m_RootOrder: 20 + m_RootOrder: 21 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -13145,7 +13461,7 @@ RectTransform: m_Children: - {fileID: 1785915489} m_Father: {fileID: 582652582} - m_RootOrder: 13 + m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -13388,7 +13704,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 582652582} - m_RootOrder: 8 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} diff --git a/sample/Assets/Scripts/AuthenticatedScript.cs b/sample/Assets/Scripts/AuthenticatedScript.cs index 2ed50d65..e433917f 100644 --- a/sample/Assets/Scripts/AuthenticatedScript.cs +++ b/sample/Assets/Scripts/AuthenticatedScript.cs @@ -243,6 +243,19 @@ public async void GetEmail() } } + public async void GetLinkedAddresses() + { + try + { + List addresses = await passport.GetLinkedAddresses(); + ShowOutput(addresses.Count > 0 ? String.Join(", ", addresses) : "No linked addresses"); + } + catch (Exception ex) + { + ShowOutput($"Failed to get linked addresses: {ex.Message}"); + } + } + public async void GetPassportId() { try diff --git a/src/Packages/Passport/Runtime/Scripts/Private/Core/Model/BrowserResponse.cs b/src/Packages/Passport/Runtime/Scripts/Private/Core/Model/BrowserResponse.cs index bae8fb1e..f14298a3 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/Core/Model/BrowserResponse.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/Core/Model/BrowserResponse.cs @@ -18,6 +18,11 @@ public class StringResponse : BrowserResponse public string result; } + public class StringListResponse : BrowserResponse + { + public string[] result; + } + public class BoolResponse : BrowserResponse { public bool result; @@ -42,6 +47,23 @@ public static string GetStringResult(this string json) } } + /// + /// Deserialises the json to StringListResponse and returns the result + /// See + /// + public static string[] GetStringListResult(this string json) + { + StringListResponse stringResponse = json.OptDeserializeObject(); + if (stringResponse != null) + { + return stringResponse.result; + } + else + { + return null; + } + } + /// /// Deserialises the json to BoolResponse and returns the result /// See diff --git a/src/Packages/Passport/Runtime/Scripts/Private/PassportFunction.cs b/src/Packages/Passport/Runtime/Scripts/Private/PassportFunction.cs index e8ef31a1..140393de 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/PassportFunction.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/PassportFunction.cs @@ -17,7 +17,7 @@ public static class PassportFunction public const string LOGOUT = "logout"; public const string GET_EMAIL = "getEmail"; public const string GET_PASSPORT_ID = "getPassportId"; - + public const string GET_LINKED_ADDRESSES = "getLinkedAddresses"; public static class IMX { public const string GET_ADDRESS = "getAddress"; diff --git a/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs b/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs index ae9da27f..45f92e19 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs @@ -652,6 +652,13 @@ public async UniTask GetIdToken() return response.GetStringResult(); } + public async UniTask> GetLinkedAddresses() + { + string response = await communicationsManager.Call(PassportFunction.GET_LINKED_ADDRESSES); + string[] addresses = response.GetStringListResult(); + return addresses != null ? addresses.ToList() : new List(); + } + // Imx public async UniTask ImxTransfer(UnsignedTransferRequest request) { diff --git a/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs b/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs index 75177daf..bf21f8cb 100644 --- a/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs +++ b/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs @@ -291,6 +291,18 @@ public UniTask GetIdToken() return GetPassportImpl().GetIdToken(); } + /// + /// Gets the list of external wallets the user has linked to their Passport account via the + /// Dashboard. + /// + /// Linked addresses + /// + /// + public async UniTask> GetLinkedAddresses() + { + return await GetPassportImpl().GetLinkedAddresses(); + } + /// /// Create a new transfer request with the given unsigned transfer request. /// diff --git a/src/Packages/Passport/Tests/Runtime/Scripts/PassportTests.cs b/src/Packages/Passport/Tests/Runtime/Scripts/PassportTests.cs index b05c9759..c39db933 100644 --- a/src/Packages/Passport/Tests/Runtime/Scripts/PassportTests.cs +++ b/src/Packages/Passport/Tests/Runtime/Scripts/PassportTests.cs @@ -42,6 +42,7 @@ public class PassportImplTests internal static string ID_TOKEN = "idToken"; internal static string ID_TOKEN_KEY = "idToken"; internal static string ADDRESS = "0xaddress"; + internal static string ADDRESS2 = "0xaddress2"; internal static string EMAIL = "unity@immutable.com"; internal static string PASSPORT_ID = "email|123457890"; internal static string SIGNATURE = "0xsignature"; @@ -1046,6 +1047,73 @@ public async Task Logout_EmptyGetLogoutUrl() Assert.AreEqual(expectedEvents.Count, authEvents.Count); Assert.AreEqual(expectedEvents, authEvents); } + + [Test] + public async Task GetLinkedAddresses_Success() + { + string[] result = { ADDRESS, ADDRESS2 }; + var response = new StringListResponse + { + success = true, + result = result + }; + communicationsManager.AddMockResponse(response); + + var linkedAddresses = await passport.GetLinkedAddresses(); + + Assert.AreEqual(2, linkedAddresses.Count); + Assert.AreEqual(ADDRESS, linkedAddresses[0]); + Assert.AreEqual(ADDRESS2, linkedAddresses[1]); + } + + [Test] + public async Task GetLinkedAddresses_Failed() + { + communicationsManager.throwExceptionOnCall = true; + + PassportException e = null; + try + { + var passportId = await passport.GetLinkedAddresses(); + } + catch (PassportException ex) + { + e = ex; + } + + Assert.NotNull(e); + } + + [Test] + public async Task GetLinkedAddresses_NullResponse() + { + var response = new StringListResponse + { + success = true, + result = null + }; + communicationsManager.AddMockResponse(response); + + var linkedAddresses = await passport.GetLinkedAddresses(); + + Assert.AreEqual(0, linkedAddresses.Count); + } + + [Test] + public async Task GetLinkedAddresses_EmptyResponse() + { + string[] result = { }; + var response = new StringListResponse + { + success = true, + result = result + }; + communicationsManager.AddMockResponse(response); + + var linkedAddresses = await passport.GetLinkedAddresses(); + + Assert.AreEqual(0, linkedAddresses.Count); + } } internal class MockBrowserCommsManager : IBrowserCommunicationsManager