Skip to content

Upgrade MetaMask SDK to 2.1.0 #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions Assets/Thirdweb/Core/Plugins/MetaMask.NEthereum/MetaMaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ public MetaMaskClient(MetaMaskWallet metaMask)
{
this._metaMask = metaMask;
}

private static readonly Random rng = new Random();
private static readonly DateTime UnixEpoch =
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

public static long GenerateRpcId()
{
Expand All @@ -38,18 +37,26 @@ protected override async Task<RpcResponseMessage> SendAsync(RpcRequestMessage me
var arrayParameters = message.RawParameters as object[];
var rawParameters = message.RawParameters;

var rpcRequestMessage = mapParameters != null
? new RpcRequestMessage(id, message.Method, mapParameters)
: arrayParameters != null
? new RpcRequestMessage(id, message.Method, arrayParameters)
: new RpcRequestMessage(id, message.Method, rawParameters);

var response = await _metaMask.Request(new MetaMaskEthereumRequest()
var rpcRequestMessage =
mapParameters != null
? new RpcRequestMessage(id, message.Method, mapParameters)
: arrayParameters != null
? new RpcRequestMessage(id, message.Method, arrayParameters)
: new RpcRequestMessage(id, message.Method, rawParameters);

var response = await _metaMask.Request(
new MetaMaskEthereumRequest()
{
Id = rpcRequestMessage.Id.ToString(),
Method = rpcRequestMessage.Method,
Parameters = rpcRequestMessage.RawParameters
}
);

if (response == null || string.IsNullOrEmpty(response.ToString()))
{
Id = rpcRequestMessage.Id.ToString(),
Method = rpcRequestMessage.Method,
Parameters = rpcRequestMessage.RawParameters
});
return new RpcResponseMessage(rpcRequestMessage.Id, result: new JObject());
}

try
{
Expand All @@ -72,4 +79,4 @@ protected override Task<RpcResponseMessage[]> SendAsync(RpcRequestMessage[] requ
return Task.WhenAll(requests.Select(r => SendAsync(r)));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</repositories>
</androidPackage>
</androidPackages>
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
<iosPods>
<!-- Global set of sources to search for Cocoapods.
These sources will be searched for all Cocoapods specified by
Expand Down Expand Up @@ -79,4 +79,4 @@
Subspecs to include for the pod.
-->
</iosPods>
</dependencies>
</dependencies>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 2753398359487877976}
- component: {fileID: 606823305735616010}
- component: {fileID: 3273917818847182916}
- component: {fileID: 4519065099083792754}
- component: {fileID: 892906291545261737}
m_Layer: 5
m_Name: Disconnect Button
Expand All @@ -34,7 +35,9 @@ RectTransform:
m_Children:
- {fileID: 1738390782584415588}
- {fileID: 4295949972570702562}
- {fileID: 7631325021668220155}
m_Father: {fileID: 4751590749222510982}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -136,6 +139,33 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &4519065099083792754
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1183405676231325757}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 718bb0aa974f2ad4ab6fb3474f3bd9b7, type: 3}
m_Name:
m_EditorClassIdentifier:
NormalColor: {r: 0.011764707, g: 0.4901961, b: 0.83921576, a: 1}
HoverColor: {r: 0.08235294, g: 0.39607847, b: 0.75294125, a: 1}
ClickColor: {r: 0.011764707, g: 0.4901961, b: 0.83921576, a: 1}
targetScale: 1.05
timeToLerp: 0.25
reverseValue: 0.95
particle:
- {fileID: 7631325021668220153}
- {fileID: 4792671844479702506}
buttonState: 0
hoverSound: {fileID: 8300000, guid: 56f8946d86006ba42b3c4a329f310ed8, type: 3}
clickSound: {fileID: 8300000, guid: 46cbfe6d75667c442b635e14528f8b17, type: 3}
clickSoundNegative: {fileID: 8300000, guid: 91663e26f21345346ab496d6dde8b530, type: 3}
DisableAnimation: 1
DisableStartAnimation: 1
--- !u!82 &892906291545261737
AudioSource:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -263,6 +293,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5777876816244660639}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -180}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -338,6 +369,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 856985863518395958}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -413,6 +445,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 411431599298750533}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -488,6 +521,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 411431599298750533}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -622,6 +656,7 @@ RectTransform:
- {fileID: 6018523544108943553}
- {fileID: 8734063940264174270}
m_Father: {fileID: 4751590749222510982}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -659,6 +694,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 411431599298750533}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -734,6 +770,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4751590749222510982}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -809,6 +846,7 @@ RectTransform:
- {fileID: 8423982654817606664}
- {fileID: 6747737215282434016}
m_Father: {fileID: 4751590749222510982}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -838,7 +876,6 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6021340919975947382}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 65.55328, y: 26.37143, z: -7.7266245}
m_LocalScale: {x: 1, y: 1, z: 1}
Expand All @@ -849,6 +886,7 @@ Transform:
- {fileID: 5073039476282446024}
- {fileID: 6015860287890676222}
m_Father: {fileID: 4751590749222510982}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6086993058777616867
GameObject:
Expand Down Expand Up @@ -881,6 +919,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5489269269375405834}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1020,6 +1059,7 @@ RectTransform:
- {fileID: 5489269269375405834}
- {fileID: 411431599298750533}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1084,6 +1124,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5489269269375405834}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1218,6 +1259,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 411431599298750533}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1352,6 +1394,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5777876816244660639}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -1427,6 +1470,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 856985863518395958}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
Expand Down Expand Up @@ -1530,3 +1574,119 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1001 &1650063118572614679
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 856985863518395958}
m_Modifications:
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_AnchorMax.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_AnchorMin.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_SizeDelta.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_SizeDelta.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalPosition.z
value: 63
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_AnchoredPosition.y
value: -19
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167789, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: m_Name
value: Click Particle
objectReference: {fileID: 0}
- target: {fileID: 9151835634102167790, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
propertyPath: prewarm
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
--- !u!198 &4792671844479702506 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 6081211963499930109, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
m_PrefabInstance: {fileID: 1650063118572614679}
m_PrefabAsset: {fileID: 0}
--- !u!198 &7631325021668220153 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 9151835634102167790, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
m_PrefabInstance: {fileID: 1650063118572614679}
m_PrefabAsset: {fileID: 0}
--- !u!224 &7631325021668220155 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 9151835634102167788, guid: 3dbebb147d43521499331681b6981bdd, type: 3}
m_PrefabInstance: {fileID: 1650063118572614679}
m_PrefabAsset: {fileID: 0}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 20df40b080d9d4749ba22a363ec31ab8, type: 3}
m_Name: UnityUI
m_EditorClassIdentifier:
spawnCanvas: 0
userAgent: UnityUGUITransport/1.0.0
_useDeeplink: 1
spawnCanvas: 1
metaMaskCanvas: {fileID: 6439922646294248678, guid: 9e03dfd5b166cc246ae7bbe9c62d6baf, type: 3}
useUniversalLinks: 0
Binary file not shown.
Binary file not shown.
Loading