-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/uplc-update
- Loading branch information
Showing
25 changed files
with
554 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/playground/src/pages/apis/wallets/browserwallet/get-supported-extensions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/playground/src/pages/providers/hydra-endpoints/on-message.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import JSONbig from "json-bigint"; | ||
|
||
import type { Metadata, Metadatum, TxMetadata } from "@meshsdk/common"; | ||
|
||
export const txMetadataToObj = (metadata: TxMetadata): Metadata[] => { | ||
const result: Metadata[] = []; | ||
metadata.forEach((value: Metadatum, key: bigint) => { | ||
result.push({ | ||
tag: key.toString(), | ||
metadata: JSONbig.stringify(metadatumToObj(value)), | ||
}); | ||
}); | ||
return result; | ||
}; | ||
|
||
const metadatumToObj = (metadatum: Metadatum): any => { | ||
if (typeof metadatum === "number" || typeof metadatum === "string") { | ||
return metadatum; | ||
} else if (typeof metadatum === "bigint") { | ||
return metadatum.toString(); | ||
} else if (metadatum instanceof Uint8Array) { | ||
return uint8ArrayToHex(metadatum); | ||
} else if (metadatum instanceof Map) { | ||
const result: Record<string | number, any> = {}; | ||
metadatum.forEach((value, key) => { | ||
result[metadatumToObj(key)] = metadatumToObj(value); | ||
}); | ||
return result; | ||
} else if (Array.isArray(metadatum)) { | ||
return metadatum.map(metadatumToObj); | ||
} else { | ||
throw new Error("metadatumToObj: Unsupported Metadatum type"); | ||
} | ||
}; | ||
|
||
const uint8ArrayToHex = (bytes: Uint8Array): string => { | ||
return Array.from(bytes) | ||
.map((byte) => byte.toString(16).padStart(2, "0")) | ||
.join(""); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./mesh-tx-builder"; | ||
export * from "./scripts"; | ||
export * from "./transaction"; | ||
export * from "./utils"; |
Oops, something went wrong.