Skip to content

Initial Commit #296

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Initial Commit #296

wants to merge 4 commits into from

Conversation

caballoninja
Copy link
Contributor

@caballoninja caballoninja commented May 8, 2025

Wallet, deploy and mint test. Editor helper not working

Version Increment

Please ensure you have incremented the package version in the package.json as necessary.

  • I have incremented the package.json according to semantic versioning
  • No version increment is needed; the change does not impact SDK or Sample code/assets

Docs Checklist

Please ensure you have addressed documentation updates if needed as part of this PR:

  • I have created a separate PR on the sequence docs repository for documentation updates: Link to docs PR
  • No documentation update is needed for this change.

Wallet, deploy and mint test. Editor helper not working
update to enable editor calls reading json body correctly
Copy link

cloudflare-workers-and-pages bot commented May 13, 2025

Deploying sequence-unity with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9f4ae8a
Status:🚫  Build failed.

View logs

@caballoninja caballoninja marked this pull request as ready for review May 27, 2025 13:40
@caballoninja caballoninja requested review from a team as code owners May 27, 2025 13:40
@@ -0,0 +1,7 @@
using UnityEngine;

[CreateAssetMenu(fileName = "SidekickConfig", menuName = "ScriptableObjects/SidekickConfig")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MenuName should be "Sequence/SidekickConfig" - this way it lives with our other scriptable objects (including the others in this PR)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably live somewhere else 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to ship this to users, it should go somewhere in the Packages folder

}
}

[MenuItem("Sequence Dev/Start Sidekick", false, 0)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if maybe "Sequence/" is a better menu item path for these - this way we can leave "Sequence Dev" for us. What do you think?

[CreateAssetMenu(fileName = "SidekickConfig", menuName = "ScriptableObjects/SidekickConfig")]
public class SidekickConfig : ScriptableObject
{
public string path;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should the path be? I tried http://localhost:8080/ but received the following error:
"Sidekick path not set or invalid: http://localhost:8080/"

Comment on lines 78 to 105
DeployResult deployResult = JsonUtility.FromJson<DeployResult>(result);

if (!string.IsNullOrEmpty(deployResult.result.txHash))
{

var receipt = await new SequenceEthClient(sidekick.Chain).WaitForTransactionReceipt(deployResult.result.txHash);

if (receipt != null)
{
string deployedAddress = ReceiptExtractor.ExtractFirstContractAddressExceptOwn(receipt, DeployERC20InitialOwner);
if (!string.IsNullOrEmpty(deployedAddress))
{
Debug.Log($"Deployed contract address: {deployedAddress}");
}
else
{
Debug.LogWarning("Could not extract deployed contract address from receipt.");
}
}
else
{
Debug.LogError("Failed to get transaction receipt.");
}
}
else
{
Debug.LogError($"Deployment error: {deployResult.result.error}");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is repeated a few times - consider using a helper function

Comment on lines 316 to 361
public async void SafeMintERC721()
{
var payload = new SafeMintERC721Payload
{
to = SafeMintERC721Recipient,
tokenId = SafeMintERC721TokenId
};
string jsonString = JsonUtility.ToJson(payload);

Debug.Log("Calling safeMint ERC721: " + jsonString);

try
{
string result = await sidekick.SafeMintERC721(SafeMintERC721ContractAddress, jsonString);
Debug.Log("safeMint result: " + result);
}
catch (System.Exception ex)
{
Debug.LogError("safeMint ERC721 failed: " + ex.Message);
}
}

public string[] SafeMintERC721BatchRecipients { get; set; }
public string[] SafeMintERC721BatchTokenIds { get; set; }

public async void SafeMintBatchERC721()
{
var payload = new SafeMintBatchERC721Payload
{
recipients = SafeMintERC721BatchRecipients,
tokenIds = SafeMintERC721BatchTokenIds
};
string jsonString = JsonUtility.ToJson(payload);

Debug.Log("Calling safeMintBatch ERC721: " + jsonString);

try
{
string result = await sidekick.SafeMintBatchERC721(SafeMintERC721ContractAddress, jsonString);
Debug.Log("safeMintBatch result: " + result);
}
catch (System.Exception ex)
{
Debug.LogError("safeMintBatch ERC721 failed: " + ex.Message);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike the other mint functions, you didn't wrap these in an EditorApplication.delayCall. Should you have?

Comment on lines 457 to 468
public string ToHexString(string input)
{
byte[] bytes = Encoding.UTF8.GetBytes(input);
StringBuilder hex = new StringBuilder("0x");

foreach (byte b in bytes)
{
hex.Append(b.ToString("x2"));
}

return hex.ToString();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this in StringExtensions for further re-usability

{
private static readonly HttpClient client = new();
private string baseUrl = "http://localhost:3000";
private string secretKey = "ultrasecretkey";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for?

Comment on lines 63 to 66
catch (HttpRequestException e)
{
throw;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant

@BellringerQuinn
Copy link
Contributor

Great demo! Some great ideas in here too. Lots of really good stuff for us to build off of in the future. Left some comments and questions for you to help with readability and integration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tasks/API calls would be much easier to integrate (and less error prone) if the methods took in objects as parameters instead of json (same goes for returning)

Fixes to scripts locations
@caballoninja caballoninja requested a review from a team June 16, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants