Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
444bbd4
Create EcosystemWallet directory and asmdef
BellringerQuinn Apr 30, 2025
2edbb39
Added default namespace to asmdef
BellringerQuinn Apr 30, 2025
a83e46c
Added Payload and related data types
BellringerQuinn Apr 30, 2025
9800b5c
Move PayloadType into it's own file as Payload is about the grow
BellringerQuinn Apr 30, 2025
ba5fed6
Added additional primitives and related methods
BellringerQuinn May 5, 2025
398943e
Added ByteArrayExtension.PadRight implementation
BellringerQuinn May 5, 2025
fd986a3
CallHash implementation
BellringerQuinn May 6, 2025
c9af264
Fix compile error
BellringerQuinn May 6, 2025
ac53cb8
Implement TypedDataToSign.GetSignPayload
BellringerQuinn May 13, 2025
4650d41
Moved some functions from Calls into Parented and moved Parented clas…
BellringerQuinn May 13, 2025
c183a25
Added Calls.Decode - finishing the Payload implementation
BellringerQuinn May 14, 2025
67ff522
Moved Payload related primitives into a directory and created a direc…
BellringerQuinn May 14, 2025
473e851
Added base data types to signature folder
BellringerQuinn May 14, 2025
1e03ee1
Added base data types to Config folder
BellringerQuinn May 14, 2025
ca790df
Added Network class definition and constructor
BellringerQuinn May 14, 2025
1e06555
Added basic data types to Attestation folder
BellringerQuinn May 14, 2025
ebdc6d5
Implemented attestation methods
BellringerQuinn May 14, 2025
46d1893
Integration test server setup and implemented some basic payload test…
BellringerQuinn May 22, 2025
38238a6
Updated README with more instructions on how to run the tests
BellringerQuinn May 22, 2025
9acf486
Fix test server argument parsing
BellringerQuinn May 22, 2025
cd2ebca
Fix SolidityDecoded.FromSolidityEncodingand added unit tests to confi…
BellringerQuinn May 23, 2025
1cefb5a
Fixed AddressCoder such that it pads addresses that are too short wit…
BellringerQuinn May 23, 2025
1dc5564
Fix null reference exception when encoding null arrays
BellringerQuinn May 29, 2025
3b4948f
Fix address comparison such that address instances that represent the…
BellringerQuinn May 29, 2025
83e301b
Added a LocalChain because the V3 tests return this chain id frequently.
BellringerQuinn May 29, 2025
7ccb5ec
Update FixedBytesCoder and StaticBytesCoder such that they both can h…
BellringerQuinn May 29, 2025
8bce78e
Fix NumberCoder such that it can handle other types of number other t…
BellringerQuinn May 29, 2025
c586762
Fix broken test
BellringerQuinn May 29, 2025
653552c
Fix encoding runtime exceptions that occur when running Payload tests
BellringerQuinn May 29, 2025
a2dce77
Added additional unit tests to help determine why the Payload integra…
BellringerQuinn May 29, 2025
ced124a
Fix TestPackCalls and implementation
BellringerQuinn May 30, 2025
c4169b9
Fix BytesCoder - simply removing the trailing 0s can cause overflows …
BellringerQuinn May 30, 2025
d69ee91
added permission primitives and its decoding/encoding functions
andygruening Jun 2, 2025
64d262a
Added a unit test to confirm we can successfully build a TypedDataToS…
BellringerQuinn Jun 2, 2025
6024e1e
Added a unit test to confirm we can successfully build a TypedDataToS…
BellringerQuinn Jun 3, 2025
4695b82
Added a unit test to confirm we can successfully created a TypedDataT…
BellringerQuinn Jun 3, 2025
42446e1
Log a bunch of stuff to debug eip712 signing
BellringerQuinn Jun 4, 2025
dd28a8d
Fix how we handle byte[] encoding
BellringerQuinn Jun 5, 2025
9de346c
Include embedded wallet address when using list sessions
BellringerQuinn Jun 5, 2025
871466d
Add additional unit test EIP712 signing and fix how we are EIP712 enc…
BellringerQuinn Jun 5, 2025
d44d3be
Get TestGetSignedPayload to pass using nethereum
BellringerQuinn Jun 5, 2025
4919b6a
Fix our conversion of Calls payloads into a type that nethereum can u…
BellringerQuinn Jun 5, 2025
9895e81
Change how we get minimum bytes needed such that tests are now passing
BellringerQuinn Jun 9, 2025
0432540
Cleaner Calls.Encode implementation
BellringerQuinn Jun 9, 2025
755ed34
Cleanup Calls.Decode implementation
BellringerQuinn Jun 9, 2025
55aac5c
Create CallsEncoder and CallEncoder as we've done with decoding as th…
BellringerQuinn Jun 9, 2025
dbd42bf
Cleanup how we convert from our data types (TypedDataToSign + NamedTy…
BellringerQuinn Jun 9, 2025
6067f63
More cleanup
BellringerQuinn Jun 9, 2025
c148c78
Added a readme explaining how to update Nethereum if needed
BellringerQuinn Jun 9, 2025
9a1e238
Fix broken unit tests by fixing class access level
BellringerQuinn Jun 12, 2025
9aa2418
Added FindSignerLeaf and GetSigners methods
BellringerQuinn Jun 12, 2025
4ae0790
Added ability to get weight of a topology or config - adding Weight c…
BellringerQuinn Jun 12, 2025
9980b2e
Added HashConfiguration method
BellringerQuinn Jun 12, 2025
27c302b
Added ability to make topology from leaves
BellringerQuinn Jun 13, 2025
a848768
Added Topology.Encode method
BellringerQuinn Jun 13, 2025
75d3564
Merge pull request #310 from 0xsequence/Feature/primitives-payloads
andygruening Jun 16, 2025
231716a
Merge branch 'V5-EcosystemWallet' into Feature/primitives-config
andygruening Jun 16, 2025
51c16c1
added config and dev tools tests, topology decoding
andygruening Jun 17, 2025
a187fdb
signing topologies
andygruening Jun 17, 2025
771780f
update testchain, and include wallet-contracts-v3 artifacts
pkieltyka Jun 17, 2025
15ca893
Merge remote-tracking branch 'origin/testchain-update' into Feature/p…
andygruening Jun 23, 2025
b66e2b4
Merge branch 'permission-primitive' into V5-EcosystemWallet
andygruening Jun 24, 2025
4b681d9
Merge branch 'V5-EcosystemWallet' into Feature/primitives-config
andygruening Jun 24, 2025
db0ec66
removed un-implemented code
andygruening Jun 24, 2025
498f570
encoding topology, leafs and signatures
andygruening Jun 27, 2025
ea86ac2
byte array encoding changes, padLeft does not throw exceptions when t…
andygruening Jun 27, 2025
6f5b540
concat and decode signatures
andygruening Jun 29, 2025
ad52d2c
latest changes
andygruening Jun 29, 2025
c2e59c4
unit test fr encoding and decoding config
andygruening Jun 29, 2025
0c52d6b
unit test for recovering random config
andygruening Jun 29, 2025
476ccec
parsing config adjustments
andygruening Jun 29, 2025
a57eaff
fix for sapient type
andygruening Jun 29, 2025
e9da413
fixed encoding of chained signatures
andygruening Jun 30, 2025
b464b0e
fixed sapient signatures
andygruening Jun 30, 2025
939488f
started adding sessions topology and leafs
andygruening Jun 30, 2025
4b16a49
started adding session tests
andygruening Jun 30, 2025
0fe11a1
parsing sessions topology to json
andygruening Jun 30, 2025
dfb7bec
parsing session permissions
andygruening Jun 30, 2025
95f506b
parsing permissions from json, test to add explicit session
andygruening Jun 30, 2025
cce53b7
adding blacklist address
andygruening Jun 30, 2025
bc68800
encoding session call signatures
andygruening Jul 1, 2025
8ead52d
flatting and minimising sessions topology
andygruening Jul 1, 2025
a5d2e00
fixed sessions branch encoding
andygruening Jul 1, 2025
d6ed318
fixed permissions and attestation parsing
andygruening Jul 1, 2025
498782c
fixed generic encoding
andygruening Jul 1, 2025
4ab48ce
removing explicit session
andygruening Jul 1, 2025
cecf48a
remove address from blacklist
andygruening Jul 1, 2025
0f85dbf
added AddressFactory
andygruening Jul 1, 2025
401d243
test to create sequence address
andygruening Jul 1, 2025
5e0edb2
Merge branch 'Feature/primitives-sessions' into Feature/primitives-co…
andygruening Jul 1, 2025
3a2d717
added primitives readme
andygruening Jul 1, 2025
bd56844
added base data type ITopology, started adding recovery tests
andygruening Jul 1, 2025
e5d47f9
started adding recovery topology
andygruening Jul 1, 2025
6f3fcb3
added recovery branch functions
andygruening Jul 1, 2025
4d8c0a1
started adding passkeys primitives and tests
andygruening Jul 1, 2025
8c105f2
fixed passkeys
andygruening Jul 1, 2025
2fee636
added address_calculate test
andygruening Jul 1, 2025
7197840
appended primitives tdd, removed some unused namespace refs
andygruening Jul 2, 2025
5a30b41
remove comment
andygruening Jul 2, 2025
82ff683
Merge pull request #318 from 0xsequence/Feature/primitives-config
andygruening Jul 8, 2025
bf5ebf4
started adding auth flow and SequenceEcosystemWalletLogin.cs
andygruening Jul 8, 2025
4eb90fe
added basic auth flow with redirectUrl from the editor
andygruening Jul 9, 2025
60aa5fe
working v3 auth flow and recovering session from secure storage
andygruening Jul 10, 2025
b40f8da
added v3 wallet demo scene and UI
andygruening Jul 10, 2025
29feb3b
ios build fixes, removed Nethereum.Web3 dll
andygruening Jul 10, 2025
9b51b93
started adding browser interfaces
andygruening Jul 10, 2025
ffb4d77
added v3 react template
andygruening Jul 11, 2025
b8ed12a
added GetPageOrigin() and calls to sign in with passkey and mnemonic
andygruening Jul 11, 2025
3ebf38e
added SessionBuilder and SessionTemplates
andygruening Jul 15, 2025
d4b12a4
added sign message request
andygruening Jul 16, 2025
b4a84c0
adjusted demo ui, removed old data classes
andygruening Jul 16, 2025
6c66a01
demo ui adjustments
andygruening Jul 16, 2025
e2978d1
started adding ios webview plugin
andygruening Jul 16, 2025
15fd0a7
Merge branch 'master' into V5-EcosystemWallet
andygruening Jul 17, 2025
12e0116
Merge branch 'V5-EcosystemWallet' into Feature/ecosystem-wallet-auth
andygruening Jul 17, 2025
96e5d1b
v3 auth working on android, added android plugin to handle deeplinks
andygruening Jul 17, 2025
5d62c28
add additional explicit sessions
andygruening Jul 18, 2025
b494919
v3 auth working on macos
andygruening Jul 18, 2025
22a04d8
some more adjustments
andygruening Jul 18, 2025
f15ba54
switching aspect ratio to portrait
andygruening Jul 18, 2025
2bd43bf
redirect working on windows builds
andygruening Jul 21, 2025
aa8051b
Merge branch 'Feature/ecosystem-wallet-auth' into V5-EcosystemWallet
andygruening Jul 23, 2025
cf3604a
added generic HttpClient to Sequence.Utils, removed it from EmbeddedW…
andygruening Jul 24, 2025
fb7e5c8
added structure for sequence session wallets
andygruening Jul 25, 2025
d848792
added ecosytem type to connect constructor
andygruening Jul 25, 2025
0fe39c9
added GetMetaTxnReceipt functions to relayer and status for receipts
andygruening Jul 25, 2025
65ae8fe
some more changes
andygruening Jul 25, 2025
d640940
some more changes
andygruening Jul 25, 2025
c41f12f
origin in addImplicitSession request, changed SequenceSessionWallet t…
andygruening Aug 4, 2025
b6364bf
started finding signers, preparing transactions
andygruening Aug 4, 2025
7a10e9d
added v3 key machine requests to get wallet config
andygruening Aug 6, 2025
8b05e0b
Merge branch 'master' into V5-EcosystemWallet
andygruening Aug 6, 2025
c318399
converting service tree to config primitive
andygruening Aug 6, 2025
40b244e
transaction test, getting sessions topology from key machine
andygruening Aug 6, 2025
c51d9e6
started signing calls with sessionSigner
andygruening Aug 7, 2025
9649f54
testing ASWebAuthenticationSession
andygruening Aug 8, 2025
9cc6ec2
create identity signer address
andygruening Aug 8, 2025
c5a61f6
get nonce from node, test to get fee options
andygruening Aug 9, 2025
e10dbe0
get config updates from key machine, more updates
andygruening Aug 9, 2025
e7e6e8a
implicit transactions are working
andygruening Aug 9, 2025
7cf20a3
started finding permissions for explicit transaction, some log cleanup
andygruening Aug 10, 2025
873e0c3
added tests for explicitEmit
andygruening Aug 10, 2025
5285145
Merge branch 'master' into V5-EcosystemWallet
andygruening Aug 10, 2025
35fe14c
handle fee options call
andygruening Aug 11, 2025
2195492
latest changes
andygruening Aug 12, 2025
5ff98dc
added IConnect interface
andygruening Aug 12, 2025
b8f1113
started adding TDDs for authentication and transactions
andygruening Aug 12, 2025
2592bf6
deploy transaction
andygruening Aug 12, 2025
12c94d6
added service classes for transactions, signing and finding signers
andygruening Aug 12, 2025
fda7078
added transaction interfaces
andygruening Aug 12, 2025
a37501f
added IPermission interface
andygruening Aug 13, 2025
dee233a
latest changes and improvements
andygruening Aug 13, 2025
5adf121
assert for session signer length
andygruening Aug 13, 2025
bde0980
directory restructure
andygruening Aug 13, 2025
3267e1d
unity version update to 2022 LTS, v3 demo updates
andygruening Aug 13, 2025
80ecff1
demo ui updates for sending transactions
andygruening Aug 14, 2025
c2b608e
added ref
andygruening Aug 14, 2025
297a613
latest changes
andygruening Aug 14, 2025
90ddd8e
chrome tabs plugin, demo scene updates
andygruening Aug 14, 2025
c8bd95d
added relayer preserve flags
andygruening Aug 14, 2025
19409c6
fixed il2cpp stripping issues for ios
andygruening Aug 14, 2025
601ce0c
Merge branch 'master' into V5-EcosystemWallet
andygruening Aug 21, 2025
f1b4feb
changed session creation args, implicit-only not allowed for passkey …
andygruening Aug 21, 2025
8ac9046
connect interface defaults to require permissions during signin
andygruening Aug 21, 2025
f9dc54a
added request to send transaction via wallet app
andygruening Sep 4, 2025
1f6c7a6
using wallet app url from SequenceConfig
andygruening Sep 4, 2025
8c679da
Merge branch 'master' into V5-EcosystemWallet
andygruening Sep 25, 2025
311c19c
updates to new create session payload args
andygruening Sep 25, 2025
beb0bff
added rc3 extension
andygruening Sep 25, 2025
4d32767
testing guard signer
andygruening Sep 26, 2025
debc4ba
guard signer uses attestation
andygruening Sep 29, 2025
51b7428
latest updates
andygruening Oct 1, 2025
1797a9f
filter out identity signers, added callIdx
andygruening Oct 1, 2025
2433103
re-enabled storage in wallet state
andygruening Oct 1, 2025
76cd5c5
fixed null address during GetImplementation
andygruening Oct 2, 2025
0381924
use the url scheme from the config by default, generate it as a fallback
andygruening Oct 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,4 @@ Assets/SequenceSDK/WaaS/Tests/Resources/
# Foundry

/testchain/lib
/testchain/artifacts/*

52 changes: 29 additions & 23 deletions Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<application>
<activity
android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sdk-powered-by-sequence"/>
</intent-filter>
</activity>
</application>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="comhorizongamesdemounitygame" />
</intent-filter>
</activity>
</application>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
</manifest>
4 changes: 1 addition & 3 deletions Assets/Plugins/Android/gradleTemplate.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
unityStreamingAssets=**STREAMING_ASSETS**
**ADDITIONAL_PROPERTIES**

android.enableR8=**MINIFY_WITH_R_EIGHT**
**ADDITIONAL_PROPERTIES**
1 change: 1 addition & 0 deletions Assets/Plugins/Android/mainTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apply plugin: 'com.android.library'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.security:security-crypto:1.1.0-alpha03'
implementation 'androidx.browser:browser:1.7.0'

**DEPS**}

Expand Down
3 changes: 3 additions & 0 deletions Assets/SequenceSDK/EcosystemWallet.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/SequenceSDK/EcosystemWallet/IntegrationTests.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Sequence.EcosystemWallet.Primitives;
using Sequence.Utils;
using UnityEngine;

namespace Sequence.EcosystemWallet.IntegrationTests
{
public class AddressTests
{
public Task<string> Calculate(Dictionary<string, object> parameters)
{
var imageHash = (string)parameters["imageHash"];
var factory = (string)parameters["factory"];
var module = (string)parameters["module"];

var address = AddressFactory.Create(imageHash.HexStringToByteArray(), factory, module);
Debug.Log($"Sequence Address: {address}");

return Task.FromResult(address.Value);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System.Collections.Generic;
using System.Numerics;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Sequence.EcosystemWallet.Primitives;
using Sequence.Utils;

namespace Sequence.EcosystemWallet.IntegrationTests
{
public class ConfigTests
{
public Task<string> ConfigNew(Dictionary<string, object> parameters)
{
var threshold = (string)parameters["threshold"];
var checkpoint = (string)parameters["checkpoint"];
var content = (string)parameters["content"];

var checkpointer = parameters.TryGetValue("checkpointer", out var checkpointerValue) &&
checkpointerValue != null ? new Address(checkpointerValue as string) : null;

var config = new Primitives.Config
{
threshold = BigInteger.Parse(threshold),
checkpoint = BigInteger.Parse(checkpoint),
topology = Topology.FromLeaves(Topology.ParseContentToLeafs(content)),
checkpointer = checkpointer
};

return Task.FromResult(JsonConvert.SerializeObject(config));
}

public Task<string> ConfigEncode(Dictionary<string, object> parameters)
{
var input = parameters["input"].ToString();
var config = Primitives.Config.FromJson(input);
var signature = new RawSignature
{
checkpointerData = null,
configuration = config,
};

var encoded = signature.Encode().ByteArrayToHexStringWithPrefix();
return Task.FromResult(encoded);
}

public Task<string> ConfigImageHash(Dictionary<string, object> parameters)
{
var input = parameters["input"].ToString();
var config = Primitives.Config.FromJson(input);
var imageHash = config.HashConfiguration().ByteArrayToHexStringWithPrefix();
return Task.FromResult(imageHash);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Sequence.EcosystemWallet.IntegrationTests
{
public class DevToolsTest
{
public Task<string> DevToolsRandomConfig(Dictionary<string, object> parameters)
{
var maxDepth = int.Parse(parameters["maxDepth"].ToString());
var seed = (string)parameters["seed"];
var minThresholdOnNested = int.Parse(parameters["minThresholdOnNested"].ToString());
var checkpointer = parameters.TryGetValue("checkpointer", out var checkpointerObj) ? checkpointerObj.ToString() : "no";
var skewed = parameters.TryGetValue("skewed", out var skewedObj) ? skewedObj.ToString() : "none";

var options = new DevTools.RandomOptions
{
seededRandom = string.IsNullOrEmpty(seed) ? null : DevTools.CreateSeededRandom(seed),
checkpointer = checkpointer,
minThresholdOnNested = minThresholdOnNested,
skewed = skewed
};

return Task.FromResult(JsonConvert.SerializeObject(DevTools.CreateRandomConfig(maxDepth, options)));
}

public Task<string> DevToolsRandomSessionTopology(Dictionary<string, object> parameters)
{
throw new System.NotImplementedException("This test is not yet used during the tests with forge.");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Sequence.EcosystemWallet.Primitives.Passkeys;
using UnityEngine;

namespace Sequence.EcosystemWallet.IntegrationTests
{
public class PasskeysTests
{
public Task<string> EncodeSignature(Dictionary<string, object> parameters)
{
var encoded = PasskeysHelper.EncodeSignature(new PasskeysArgs
{
x = (string)parameters["x"],
y = (string)parameters["y"],
r = (string)parameters["r"],
s = (string)parameters["s"],
requireUserVerification = (bool)parameters["requireUserVerification"],
embedMetadata = (bool)parameters["embedMetadata"],
credentialId = parameters.TryGetValue("credentialId", out var credentialIdValue) ? (string)credentialIdValue : null,
metadataHash = parameters.TryGetValue("metadataHash", out var metadataHashValue) ? (string)metadataHashValue : null,
authenticatorData = (string)parameters["authenticatorData"],
clientDataJson = parameters["clientDataJson"].ToString(),
});

return Task.FromResult(encoded);
}

public Task<string> DecodeSignature(Dictionary<string, object> parameters)
{
throw new System.NotImplementedException();
}

public Task<string> ComputeRoot(Dictionary<string, object> parameters)
{
var x = (string)parameters["x"];
var y = (string)parameters["y"];
var requireUserVerification = (bool)parameters["requireUserVerification"];
var credentialId = parameters.TryGetValue("credentialId", out var credentialIdValue) ? (string)credentialIdValue : null;
var metadataHash = parameters.TryGetValue("metadataHash", out var metadataHashValue) ? (string)metadataHashValue : null;

var result = PasskeysHelper.ComputeRoot(new PasskeysArgs
{
x = x,
y = y,
requireUserVerification = requireUserVerification,
credentialId = credentialId,
metadataHash = metadataHash
});

return Task.FromResult(result);
}

public Task<string> ValidateSignature(Dictionary<string, object> parameters)
{
throw new System.NotImplementedException();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Sequence.ABI;
using Sequence.EcosystemWallet.Primitives;
using Sequence.Utils;

namespace Sequence.EcosystemWallet.IntegrationTests
{
public class PayloadTests
{
public async Task<string> PayloadToAbi(Dictionary<string, object> parameters)
{
string inputPayload = parameters["payload"] as string;
throw new NotImplementedException("Not implemented");
}

public async Task<string> PayloadToPacked(Dictionary<string, object> parameters)
{
string inputPayload = (string)parameters["payload"];
Address wallet = parameters.TryGetValue("wallet", out var walletValue) && walletValue is string walletStr
? new Address(walletStr)
: null;
string result = DoConvertToPacked(inputPayload, wallet);
return result;
}

private string DoConvertToPacked(string payload, Address wallet)
{
Parented decodedPayload = Decode(payload);

if (decodedPayload.payload.isCalls)
{
byte[] packed = ((Calls)decodedPayload.payload).Encode(wallet);
string packedHex = packed.ByteArrayToHexStringWithPrefix();
return packedHex;
}

throw new Exception("Not implemented or unsupported payload format");
}

public async Task<string> PayloadToJson(Dictionary<string, object> parameters)
{
string inputPayload = (string)parameters["payload"];
Address wallet = new Address((string)parameters["wallet"]);
string result = DoConvertToJson(inputPayload);
return result;
}

private string DoConvertToJson(string payload)
{
SolidityDecoded decoded = SolidityDecoded.FromSolidityEncoding(payload);
return JsonConvert.SerializeObject(decoded);
}

public async Task<string> PayloadHashFor(Dictionary<string, object> parameters)
{
string inputPayload = (string)parameters["payload"];
Address wallet = new Address((string)parameters["wallet"]);
string chainId = (string)parameters["chainId"];
string result = DoHash(inputPayload, wallet, chainId);
return result;
}

private string DoHash(string payload, Address wallet, string chainId)
{
Parented decodedPayload = Decode(payload);

byte[] hashed = decodedPayload.Hash(wallet, ChainDictionaries.ChainById[chainId]);
return hashed.ByteArrayToHexStringWithPrefix();
}

private Parented Decode(string payload)
{
Parented decodedPayload = null;
try
{
decodedPayload = Parented.DecodeFromSolidityEncoding(payload);
}
catch (Exception ex)
{
throw new Exception($"Failed to decode payload: {ex.Message}", ex);
}

if (decodedPayload == null || decodedPayload.payload == null)
{
throw new Exception("Decoded payload is null or invalid");
}

return decodedPayload;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading