@thru/thru-sdk 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4JWHIX3Q.js → chunk-SHMREHP5.js} +11 -7
- package/dist/chunk-SHMREHP5.js.map +1 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.js +3 -2
- package/dist/client.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/sdk.d.ts +2 -2
- package/dist/sdk.js +1 -1
- package/dist/{transactions-CJsRFL_T.d.ts → transactions-CLezIeXO.d.ts} +5 -3
- package/package.json +3 -3
- package/dist/chunk-4JWHIX3Q.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { signAsync } from '@noble/ed25519';
|
|
1
|
+
import { signAsync, getPublicKeyAsync } from '@noble/ed25519';
|
|
2
2
|
import { decodeSignature, decodeBase64, decodeAddress, ensureBytes, encodeAddress, isHexString, hexToBytes, encodeSignature } from '@thru/helpers';
|
|
3
3
|
import { messageDesc, fileDesc, serviceDesc } from '@bufbuild/protobuf/codegenv2';
|
|
4
4
|
import { file_google_protobuf_timestamp, file_google_protobuf_descriptor, file_google_protobuf_duration } from '@bufbuild/protobuf/wkt';
|
|
@@ -661,6 +661,7 @@ function getEvent(ctx, eventId, options = {}) {
|
|
|
661
661
|
// thru-ts-client-sdk/modules/keys.ts
|
|
662
662
|
var keys_exports = {};
|
|
663
663
|
__export(keys_exports, {
|
|
664
|
+
fromPrivateKey: () => fromPrivateKey,
|
|
664
665
|
generateKeyPair: () => generateKeyPair
|
|
665
666
|
});
|
|
666
667
|
async function generateKeyPair() {
|
|
@@ -673,6 +674,9 @@ async function generateKeyPair() {
|
|
|
673
674
|
privateKey: account.privateKey
|
|
674
675
|
};
|
|
675
676
|
}
|
|
677
|
+
async function fromPrivateKey(privateKey) {
|
|
678
|
+
return new Uint8Array(await getPublicKeyAsync(privateKey));
|
|
679
|
+
}
|
|
676
680
|
function generateSeed() {
|
|
677
681
|
const cryptoObj = getWebCrypto();
|
|
678
682
|
const bytes = new Uint8Array(64);
|
|
@@ -841,7 +845,7 @@ async function createBuildParams(ctx, options) {
|
|
|
841
845
|
const header = await createTransactionHeader(ctx, options.header ?? {}, feePayerPublicKey);
|
|
842
846
|
const accounts = parseAccounts(options.accounts);
|
|
843
847
|
const context = createInstructionContext(feePayerPublicKey, program, accounts);
|
|
844
|
-
const instructionData = resolveInstructionData(options.instructionData, context);
|
|
848
|
+
const instructionData = await resolveInstructionData(options.instructionData, context);
|
|
845
849
|
const proofs = createProofs(options);
|
|
846
850
|
return {
|
|
847
851
|
feePayer: {
|
|
@@ -919,12 +923,12 @@ function createInstructionContext(feePayer, program, accounts) {
|
|
|
919
923
|
};
|
|
920
924
|
return { accounts: allAccounts, getAccountIndex };
|
|
921
925
|
}
|
|
922
|
-
function resolveInstructionData(value, context) {
|
|
926
|
+
async function resolveInstructionData(value, context) {
|
|
923
927
|
if (value === void 0) {
|
|
924
928
|
return void 0;
|
|
925
929
|
}
|
|
926
930
|
if (typeof value === "function") {
|
|
927
|
-
return value(context);
|
|
931
|
+
return await value(context);
|
|
928
932
|
}
|
|
929
933
|
if (value instanceof Uint8Array) {
|
|
930
934
|
return value;
|
|
@@ -955,6 +959,6 @@ async function fetchFinalizedSlot(ctx) {
|
|
|
955
959
|
return height.finalized;
|
|
956
960
|
}
|
|
957
961
|
|
|
958
|
-
export { CommandService, ConsensusStatus, DEFAULT_HOST, FilterParamValueSchema, FilterSchema, GetVersionRequestSchema, QueryService, StreamingService, Transaction, TransactionBuilder, accounts_exports, batchSendTransactions, blocks_exports, buildAndSignTransaction, buildTransaction, createAccount, deriveProgramAddress, events_exports, generateKeyPair, generateStateProof, getAccount, getBlock, getBlockHeight, getEvent, getRawAccount, getRawBlock, getRawTransaction, getTransaction, getTransactionStatus, height_exports, keys_exports, listAccounts, listBlocks, listTransactionsForAccount, proofs_exports, sendTransaction, streamAccountUpdates, streamBlocks, streamEvents, streamTransactions, streaming_exports, toBlockHash, toPubkey, toSignature, trackTransaction, transactions_exports };
|
|
959
|
-
//# sourceMappingURL=chunk-
|
|
960
|
-
//# sourceMappingURL=chunk-
|
|
962
|
+
export { CommandService, ConsensusStatus, DEFAULT_HOST, FilterParamValueSchema, FilterSchema, GetVersionRequestSchema, QueryService, StreamingService, Transaction, TransactionBuilder, accounts_exports, batchSendTransactions, blocks_exports, buildAndSignTransaction, buildTransaction, createAccount, deriveProgramAddress, events_exports, fromPrivateKey, generateKeyPair, generateStateProof, getAccount, getBlock, getBlockHeight, getEvent, getRawAccount, getRawBlock, getRawTransaction, getTransaction, getTransactionStatus, height_exports, keys_exports, listAccounts, listBlocks, listTransactionsForAccount, proofs_exports, sendTransaction, streamAccountUpdates, streamBlocks, streamEvents, streamTransactions, streaming_exports, toBlockHash, toPubkey, toSignature, trackTransaction, transactions_exports };
|
|
963
|
+
//# sourceMappingURL=chunk-SHMREHP5.js.map
|
|
964
|
+
//# sourceMappingURL=chunk-SHMREHP5.js.map
|