seismic-viem 1.0.1 → 1.0.2
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/_cjs/index.js
CHANGED
|
@@ -839,7 +839,7 @@ var init_size = () => {
|
|
|
839
839
|
};
|
|
840
840
|
|
|
841
841
|
// ../../node_modules/viem/_esm/errors/version.js
|
|
842
|
-
var version2 = "2.22.
|
|
842
|
+
var version2 = "2.22.4";
|
|
843
843
|
|
|
844
844
|
// ../../node_modules/viem/_esm/errors/base.js
|
|
845
845
|
function walk(err, fn) {
|
|
@@ -67870,9 +67870,6 @@ function toRlp(bytes, to = "hex") {
|
|
|
67870
67870
|
return bytesToHex(cursor.bytes);
|
|
67871
67871
|
return cursor.bytes;
|
|
67872
67872
|
}
|
|
67873
|
-
function hexToRlp(hex, to = "hex") {
|
|
67874
|
-
return toRlp(hex, to);
|
|
67875
|
-
}
|
|
67876
67873
|
function getEncodable(bytes) {
|
|
67877
67874
|
if (Array.isArray(bytes))
|
|
67878
67875
|
return getEncodableList(bytes.map((x) => getEncodable(x)));
|
|
@@ -68832,21 +68829,6 @@ async function prepareTransactionRequest(client, args) {
|
|
|
68832
68829
|
}
|
|
68833
68830
|
if (parameters.includes("chainId"))
|
|
68834
68831
|
request.chainId = await getChainId2();
|
|
68835
|
-
if (parameters.includes("nonce") && typeof nonce === "undefined" && account) {
|
|
68836
|
-
if (nonceManager) {
|
|
68837
|
-
const chainId2 = await getChainId2();
|
|
68838
|
-
request.nonce = await nonceManager.consume({
|
|
68839
|
-
address: account.address,
|
|
68840
|
-
chainId: chainId2,
|
|
68841
|
-
client
|
|
68842
|
-
});
|
|
68843
|
-
} else {
|
|
68844
|
-
request.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
|
|
68845
|
-
address: account.address,
|
|
68846
|
-
blockTag: "pending"
|
|
68847
|
-
});
|
|
68848
|
-
}
|
|
68849
|
-
}
|
|
68850
68832
|
if ((parameters.includes("fees") || parameters.includes("type")) && typeof type === "undefined") {
|
|
68851
68833
|
try {
|
|
68852
68834
|
request.type = getTransactionType(request);
|
|
@@ -68889,6 +68871,21 @@ async function prepareTransactionRequest(client, args) {
|
|
|
68889
68871
|
...request,
|
|
68890
68872
|
account: account ? { address: account.address, type: "json-rpc" } : account
|
|
68891
68873
|
});
|
|
68874
|
+
if (parameters.includes("nonce") && typeof nonce === "undefined" && account) {
|
|
68875
|
+
if (nonceManager) {
|
|
68876
|
+
const chainId2 = await getChainId2();
|
|
68877
|
+
request.nonce = await nonceManager.consume({
|
|
68878
|
+
address: account.address,
|
|
68879
|
+
chainId: chainId2,
|
|
68880
|
+
client
|
|
68881
|
+
});
|
|
68882
|
+
} else {
|
|
68883
|
+
request.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
|
|
68884
|
+
address: account.address,
|
|
68885
|
+
blockTag: "pending"
|
|
68886
|
+
});
|
|
68887
|
+
}
|
|
68888
|
+
}
|
|
68892
68889
|
assertRequest(request);
|
|
68893
68890
|
delete request.parameters;
|
|
68894
68891
|
return request;
|
|
@@ -72446,7 +72443,7 @@ async function waitForTransactionReceipt(client, {
|
|
|
72446
72443
|
if (confirmations > 1 && (!receipt.blockNumber || blockNumber - receipt.blockNumber + 1n < confirmations))
|
|
72447
72444
|
return;
|
|
72448
72445
|
let reason = "replaced";
|
|
72449
|
-
if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value) {
|
|
72446
|
+
if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value && replacementTransaction.input === replacedTransaction.input) {
|
|
72450
72447
|
reason = "repriced";
|
|
72451
72448
|
} else if (replacementTransaction.from === replacementTransaction.to && replacementTransaction.value === 0n) {
|
|
72452
72449
|
reason = "cancelled";
|
|
@@ -73556,74 +73553,6 @@ async function signedCall(client, args) {
|
|
|
73556
73553
|
});
|
|
73557
73554
|
}
|
|
73558
73555
|
}
|
|
73559
|
-
// ../../node_modules/@noble/hashes/esm/hmac.js
|
|
73560
|
-
init__assert();
|
|
73561
|
-
init_utils2();
|
|
73562
|
-
|
|
73563
|
-
class HMAC2 extends Hash {
|
|
73564
|
-
constructor(hash2, _key) {
|
|
73565
|
-
super();
|
|
73566
|
-
this.finished = false;
|
|
73567
|
-
this.destroyed = false;
|
|
73568
|
-
ahash(hash2);
|
|
73569
|
-
const key = toBytes2(_key);
|
|
73570
|
-
this.iHash = hash2.create();
|
|
73571
|
-
if (typeof this.iHash.update !== "function")
|
|
73572
|
-
throw new Error("Expected instance of class which extends utils.Hash");
|
|
73573
|
-
this.blockLen = this.iHash.blockLen;
|
|
73574
|
-
this.outputLen = this.iHash.outputLen;
|
|
73575
|
-
const blockLen = this.blockLen;
|
|
73576
|
-
const pad3 = new Uint8Array(blockLen);
|
|
73577
|
-
pad3.set(key.length > blockLen ? hash2.create().update(key).digest() : key);
|
|
73578
|
-
for (let i = 0;i < pad3.length; i++)
|
|
73579
|
-
pad3[i] ^= 54;
|
|
73580
|
-
this.iHash.update(pad3);
|
|
73581
|
-
this.oHash = hash2.create();
|
|
73582
|
-
for (let i = 0;i < pad3.length; i++)
|
|
73583
|
-
pad3[i] ^= 54 ^ 92;
|
|
73584
|
-
this.oHash.update(pad3);
|
|
73585
|
-
pad3.fill(0);
|
|
73586
|
-
}
|
|
73587
|
-
update(buf) {
|
|
73588
|
-
aexists(this);
|
|
73589
|
-
this.iHash.update(buf);
|
|
73590
|
-
return this;
|
|
73591
|
-
}
|
|
73592
|
-
digestInto(out) {
|
|
73593
|
-
aexists(this);
|
|
73594
|
-
abytes(out, this.outputLen);
|
|
73595
|
-
this.finished = true;
|
|
73596
|
-
this.iHash.digestInto(out);
|
|
73597
|
-
this.oHash.update(out);
|
|
73598
|
-
this.oHash.digestInto(out);
|
|
73599
|
-
this.destroy();
|
|
73600
|
-
}
|
|
73601
|
-
digest() {
|
|
73602
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
|
73603
|
-
this.digestInto(out);
|
|
73604
|
-
return out;
|
|
73605
|
-
}
|
|
73606
|
-
_cloneInto(to) {
|
|
73607
|
-
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
73608
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
73609
|
-
to = to;
|
|
73610
|
-
to.finished = finished;
|
|
73611
|
-
to.destroyed = destroyed;
|
|
73612
|
-
to.blockLen = blockLen;
|
|
73613
|
-
to.outputLen = outputLen;
|
|
73614
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
|
73615
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
|
73616
|
-
return to;
|
|
73617
|
-
}
|
|
73618
|
-
destroy() {
|
|
73619
|
-
this.destroyed = true;
|
|
73620
|
-
this.oHash.destroy();
|
|
73621
|
-
this.iHash.destroy();
|
|
73622
|
-
}
|
|
73623
|
-
}
|
|
73624
|
-
var hmac2 = (hash2, key, message) => new HMAC2(hash2, key).update(message).digest();
|
|
73625
|
-
hmac2.create = (hash2, key) => new HMAC2(hash2, key);
|
|
73626
|
-
|
|
73627
73556
|
// ../../node_modules/viem/_esm/accounts/privateKeyToAccount.js
|
|
73628
73557
|
init_secp256k1();
|
|
73629
73558
|
init_toHex();
|
|
@@ -73962,6 +73891,76 @@ async function signedReadContract(client, parameters) {
|
|
|
73962
73891
|
// ../../node_modules/@noble/hashes/esm/hkdf.js
|
|
73963
73892
|
init__assert();
|
|
73964
73893
|
init_utils2();
|
|
73894
|
+
|
|
73895
|
+
// ../../node_modules/@noble/hashes/esm/hmac.js
|
|
73896
|
+
init__assert();
|
|
73897
|
+
init_utils2();
|
|
73898
|
+
|
|
73899
|
+
class HMAC2 extends Hash {
|
|
73900
|
+
constructor(hash2, _key) {
|
|
73901
|
+
super();
|
|
73902
|
+
this.finished = false;
|
|
73903
|
+
this.destroyed = false;
|
|
73904
|
+
ahash(hash2);
|
|
73905
|
+
const key = toBytes2(_key);
|
|
73906
|
+
this.iHash = hash2.create();
|
|
73907
|
+
if (typeof this.iHash.update !== "function")
|
|
73908
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
73909
|
+
this.blockLen = this.iHash.blockLen;
|
|
73910
|
+
this.outputLen = this.iHash.outputLen;
|
|
73911
|
+
const blockLen = this.blockLen;
|
|
73912
|
+
const pad3 = new Uint8Array(blockLen);
|
|
73913
|
+
pad3.set(key.length > blockLen ? hash2.create().update(key).digest() : key);
|
|
73914
|
+
for (let i = 0;i < pad3.length; i++)
|
|
73915
|
+
pad3[i] ^= 54;
|
|
73916
|
+
this.iHash.update(pad3);
|
|
73917
|
+
this.oHash = hash2.create();
|
|
73918
|
+
for (let i = 0;i < pad3.length; i++)
|
|
73919
|
+
pad3[i] ^= 54 ^ 92;
|
|
73920
|
+
this.oHash.update(pad3);
|
|
73921
|
+
pad3.fill(0);
|
|
73922
|
+
}
|
|
73923
|
+
update(buf) {
|
|
73924
|
+
aexists(this);
|
|
73925
|
+
this.iHash.update(buf);
|
|
73926
|
+
return this;
|
|
73927
|
+
}
|
|
73928
|
+
digestInto(out) {
|
|
73929
|
+
aexists(this);
|
|
73930
|
+
abytes(out, this.outputLen);
|
|
73931
|
+
this.finished = true;
|
|
73932
|
+
this.iHash.digestInto(out);
|
|
73933
|
+
this.oHash.update(out);
|
|
73934
|
+
this.oHash.digestInto(out);
|
|
73935
|
+
this.destroy();
|
|
73936
|
+
}
|
|
73937
|
+
digest() {
|
|
73938
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
|
73939
|
+
this.digestInto(out);
|
|
73940
|
+
return out;
|
|
73941
|
+
}
|
|
73942
|
+
_cloneInto(to) {
|
|
73943
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
73944
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
73945
|
+
to = to;
|
|
73946
|
+
to.finished = finished;
|
|
73947
|
+
to.destroyed = destroyed;
|
|
73948
|
+
to.blockLen = blockLen;
|
|
73949
|
+
to.outputLen = outputLen;
|
|
73950
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
|
73951
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
|
73952
|
+
return to;
|
|
73953
|
+
}
|
|
73954
|
+
destroy() {
|
|
73955
|
+
this.destroyed = true;
|
|
73956
|
+
this.oHash.destroy();
|
|
73957
|
+
this.iHash.destroy();
|
|
73958
|
+
}
|
|
73959
|
+
}
|
|
73960
|
+
var hmac2 = (hash2, key, message) => new HMAC2(hash2, key).update(message).digest();
|
|
73961
|
+
hmac2.create = (hash2, key) => new HMAC2(hash2, key);
|
|
73962
|
+
|
|
73963
|
+
// ../../node_modules/@noble/hashes/esm/hkdf.js
|
|
73965
73964
|
function extract2(hash2, ikm, salt) {
|
|
73966
73965
|
ahash(hash2);
|
|
73967
73966
|
if (salt === undefined)
|
|
@@ -73997,7 +73996,11 @@ function expand(hash2, prk, info, length = 32) {
|
|
|
73997
73996
|
var hkdf = (hash2, ikm, salt, info, length) => expand(hash2, extract2(hash2, ikm, salt), info, length);
|
|
73998
73997
|
|
|
73999
73998
|
// src/crypto/aes.ts
|
|
74000
|
-
var {
|
|
73999
|
+
var {
|
|
74000
|
+
createECDH,
|
|
74001
|
+
createCipheriv,
|
|
74002
|
+
createDecipheriv
|
|
74003
|
+
} = require_crypto_browserify();
|
|
74001
74004
|
|
|
74002
74005
|
class AesGcmCrypto {
|
|
74003
74006
|
key;
|
|
@@ -74021,10 +74024,6 @@ class AesGcmCrypto {
|
|
|
74021
74024
|
}
|
|
74022
74025
|
return nonceBuffer;
|
|
74023
74026
|
}
|
|
74024
|
-
rlpEncodeInput(data) {
|
|
74025
|
-
const rlpEncoded = hexToRlp(data);
|
|
74026
|
-
return new Uint8Array(Buffer.from(rlpEncoded.slice(2), "hex"));
|
|
74027
|
-
}
|
|
74028
74027
|
validateAndConvertNonce(nonce) {
|
|
74029
74028
|
const nonceBuffer = Buffer.from(nonce.slice(2), "hex");
|
|
74030
74029
|
if (nonceBuffer.length !== this.NONCE_LENGTH) {
|
|
@@ -74037,11 +74036,11 @@ class AesGcmCrypto {
|
|
|
74037
74036
|
}
|
|
74038
74037
|
encrypt(plaintext, nonce) {
|
|
74039
74038
|
const nonceBuffer = new Uint8Array(typeof nonce === "string" ? this.validateAndConvertNonce(nonce) : this.numberToNonce(nonce));
|
|
74040
|
-
const rlpEncodedData = this.rlpEncodeInput(plaintext);
|
|
74041
74039
|
const key = new Uint8Array(Buffer.from(this.key.slice(2), "hex"));
|
|
74042
74040
|
const cipher = createCipheriv(this.ALGORITHM, key, nonceBuffer);
|
|
74041
|
+
const callData = new Uint8Array(Buffer.from(plaintext.slice(2), "hex"));
|
|
74043
74042
|
const ciphertext = Buffer.concat([
|
|
74044
|
-
new Uint8Array(cipher.update(
|
|
74043
|
+
new Uint8Array(cipher.update(callData)),
|
|
74045
74044
|
new Uint8Array(cipher.final()),
|
|
74046
74045
|
new Uint8Array(cipher.getAuthTag())
|
|
74047
74046
|
]);
|
|
@@ -74061,8 +74060,7 @@ class AesGcmCrypto {
|
|
|
74061
74060
|
new Uint8Array(decipher.update(encryptedData)),
|
|
74062
74061
|
new Uint8Array(decipher.final())
|
|
74063
74062
|
]));
|
|
74064
|
-
|
|
74065
|
-
return `0x${decoded.toString("hex")}`;
|
|
74063
|
+
return `0x${Buffer.from(decrypted).toString("hex")}`;
|
|
74066
74064
|
}
|
|
74067
74065
|
}
|
|
74068
74066
|
var generateSharedKey = ({
|
package/dist/_esm/index.js
CHANGED
|
@@ -846,7 +846,7 @@ var init_size = () => {
|
|
|
846
846
|
};
|
|
847
847
|
|
|
848
848
|
// ../../node_modules/viem/_esm/errors/version.js
|
|
849
|
-
var version2 = "2.22.
|
|
849
|
+
var version2 = "2.22.4";
|
|
850
850
|
|
|
851
851
|
// ../../node_modules/viem/_esm/errors/base.js
|
|
852
852
|
function walk(err, fn) {
|
|
@@ -67858,9 +67858,6 @@ function toRlp(bytes, to = "hex") {
|
|
|
67858
67858
|
return bytesToHex(cursor.bytes);
|
|
67859
67859
|
return cursor.bytes;
|
|
67860
67860
|
}
|
|
67861
|
-
function hexToRlp(hex, to = "hex") {
|
|
67862
|
-
return toRlp(hex, to);
|
|
67863
|
-
}
|
|
67864
67861
|
function getEncodable(bytes) {
|
|
67865
67862
|
if (Array.isArray(bytes))
|
|
67866
67863
|
return getEncodableList(bytes.map((x) => getEncodable(x)));
|
|
@@ -68820,21 +68817,6 @@ async function prepareTransactionRequest(client, args) {
|
|
|
68820
68817
|
}
|
|
68821
68818
|
if (parameters.includes("chainId"))
|
|
68822
68819
|
request.chainId = await getChainId2();
|
|
68823
|
-
if (parameters.includes("nonce") && typeof nonce === "undefined" && account) {
|
|
68824
|
-
if (nonceManager) {
|
|
68825
|
-
const chainId2 = await getChainId2();
|
|
68826
|
-
request.nonce = await nonceManager.consume({
|
|
68827
|
-
address: account.address,
|
|
68828
|
-
chainId: chainId2,
|
|
68829
|
-
client
|
|
68830
|
-
});
|
|
68831
|
-
} else {
|
|
68832
|
-
request.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
|
|
68833
|
-
address: account.address,
|
|
68834
|
-
blockTag: "pending"
|
|
68835
|
-
});
|
|
68836
|
-
}
|
|
68837
|
-
}
|
|
68838
68820
|
if ((parameters.includes("fees") || parameters.includes("type")) && typeof type === "undefined") {
|
|
68839
68821
|
try {
|
|
68840
68822
|
request.type = getTransactionType(request);
|
|
@@ -68877,6 +68859,21 @@ async function prepareTransactionRequest(client, args) {
|
|
|
68877
68859
|
...request,
|
|
68878
68860
|
account: account ? { address: account.address, type: "json-rpc" } : account
|
|
68879
68861
|
});
|
|
68862
|
+
if (parameters.includes("nonce") && typeof nonce === "undefined" && account) {
|
|
68863
|
+
if (nonceManager) {
|
|
68864
|
+
const chainId2 = await getChainId2();
|
|
68865
|
+
request.nonce = await nonceManager.consume({
|
|
68866
|
+
address: account.address,
|
|
68867
|
+
chainId: chainId2,
|
|
68868
|
+
client
|
|
68869
|
+
});
|
|
68870
|
+
} else {
|
|
68871
|
+
request.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
|
|
68872
|
+
address: account.address,
|
|
68873
|
+
blockTag: "pending"
|
|
68874
|
+
});
|
|
68875
|
+
}
|
|
68876
|
+
}
|
|
68880
68877
|
assertRequest(request);
|
|
68881
68878
|
delete request.parameters;
|
|
68882
68879
|
return request;
|
|
@@ -72434,7 +72431,7 @@ async function waitForTransactionReceipt(client, {
|
|
|
72434
72431
|
if (confirmations > 1 && (!receipt.blockNumber || blockNumber - receipt.blockNumber + 1n < confirmations))
|
|
72435
72432
|
return;
|
|
72436
72433
|
let reason = "replaced";
|
|
72437
|
-
if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value) {
|
|
72434
|
+
if (replacementTransaction.to === replacedTransaction.to && replacementTransaction.value === replacedTransaction.value && replacementTransaction.input === replacedTransaction.input) {
|
|
72438
72435
|
reason = "repriced";
|
|
72439
72436
|
} else if (replacementTransaction.from === replacementTransaction.to && replacementTransaction.value === 0n) {
|
|
72440
72437
|
reason = "cancelled";
|
|
@@ -73544,74 +73541,6 @@ async function signedCall(client, args) {
|
|
|
73544
73541
|
});
|
|
73545
73542
|
}
|
|
73546
73543
|
}
|
|
73547
|
-
// ../../node_modules/@noble/hashes/esm/hmac.js
|
|
73548
|
-
init__assert();
|
|
73549
|
-
init_utils2();
|
|
73550
|
-
|
|
73551
|
-
class HMAC2 extends Hash {
|
|
73552
|
-
constructor(hash2, _key) {
|
|
73553
|
-
super();
|
|
73554
|
-
this.finished = false;
|
|
73555
|
-
this.destroyed = false;
|
|
73556
|
-
ahash(hash2);
|
|
73557
|
-
const key = toBytes2(_key);
|
|
73558
|
-
this.iHash = hash2.create();
|
|
73559
|
-
if (typeof this.iHash.update !== "function")
|
|
73560
|
-
throw new Error("Expected instance of class which extends utils.Hash");
|
|
73561
|
-
this.blockLen = this.iHash.blockLen;
|
|
73562
|
-
this.outputLen = this.iHash.outputLen;
|
|
73563
|
-
const blockLen = this.blockLen;
|
|
73564
|
-
const pad3 = new Uint8Array(blockLen);
|
|
73565
|
-
pad3.set(key.length > blockLen ? hash2.create().update(key).digest() : key);
|
|
73566
|
-
for (let i = 0;i < pad3.length; i++)
|
|
73567
|
-
pad3[i] ^= 54;
|
|
73568
|
-
this.iHash.update(pad3);
|
|
73569
|
-
this.oHash = hash2.create();
|
|
73570
|
-
for (let i = 0;i < pad3.length; i++)
|
|
73571
|
-
pad3[i] ^= 54 ^ 92;
|
|
73572
|
-
this.oHash.update(pad3);
|
|
73573
|
-
pad3.fill(0);
|
|
73574
|
-
}
|
|
73575
|
-
update(buf) {
|
|
73576
|
-
aexists(this);
|
|
73577
|
-
this.iHash.update(buf);
|
|
73578
|
-
return this;
|
|
73579
|
-
}
|
|
73580
|
-
digestInto(out) {
|
|
73581
|
-
aexists(this);
|
|
73582
|
-
abytes(out, this.outputLen);
|
|
73583
|
-
this.finished = true;
|
|
73584
|
-
this.iHash.digestInto(out);
|
|
73585
|
-
this.oHash.update(out);
|
|
73586
|
-
this.oHash.digestInto(out);
|
|
73587
|
-
this.destroy();
|
|
73588
|
-
}
|
|
73589
|
-
digest() {
|
|
73590
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
|
73591
|
-
this.digestInto(out);
|
|
73592
|
-
return out;
|
|
73593
|
-
}
|
|
73594
|
-
_cloneInto(to) {
|
|
73595
|
-
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
73596
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
73597
|
-
to = to;
|
|
73598
|
-
to.finished = finished;
|
|
73599
|
-
to.destroyed = destroyed;
|
|
73600
|
-
to.blockLen = blockLen;
|
|
73601
|
-
to.outputLen = outputLen;
|
|
73602
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
|
73603
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
|
73604
|
-
return to;
|
|
73605
|
-
}
|
|
73606
|
-
destroy() {
|
|
73607
|
-
this.destroyed = true;
|
|
73608
|
-
this.oHash.destroy();
|
|
73609
|
-
this.iHash.destroy();
|
|
73610
|
-
}
|
|
73611
|
-
}
|
|
73612
|
-
var hmac2 = (hash2, key, message) => new HMAC2(hash2, key).update(message).digest();
|
|
73613
|
-
hmac2.create = (hash2, key) => new HMAC2(hash2, key);
|
|
73614
|
-
|
|
73615
73544
|
// ../../node_modules/viem/_esm/accounts/privateKeyToAccount.js
|
|
73616
73545
|
init_secp256k1();
|
|
73617
73546
|
init_toHex();
|
|
@@ -73950,6 +73879,76 @@ async function signedReadContract(client, parameters) {
|
|
|
73950
73879
|
// ../../node_modules/@noble/hashes/esm/hkdf.js
|
|
73951
73880
|
init__assert();
|
|
73952
73881
|
init_utils2();
|
|
73882
|
+
|
|
73883
|
+
// ../../node_modules/@noble/hashes/esm/hmac.js
|
|
73884
|
+
init__assert();
|
|
73885
|
+
init_utils2();
|
|
73886
|
+
|
|
73887
|
+
class HMAC2 extends Hash {
|
|
73888
|
+
constructor(hash2, _key) {
|
|
73889
|
+
super();
|
|
73890
|
+
this.finished = false;
|
|
73891
|
+
this.destroyed = false;
|
|
73892
|
+
ahash(hash2);
|
|
73893
|
+
const key = toBytes2(_key);
|
|
73894
|
+
this.iHash = hash2.create();
|
|
73895
|
+
if (typeof this.iHash.update !== "function")
|
|
73896
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
73897
|
+
this.blockLen = this.iHash.blockLen;
|
|
73898
|
+
this.outputLen = this.iHash.outputLen;
|
|
73899
|
+
const blockLen = this.blockLen;
|
|
73900
|
+
const pad3 = new Uint8Array(blockLen);
|
|
73901
|
+
pad3.set(key.length > blockLen ? hash2.create().update(key).digest() : key);
|
|
73902
|
+
for (let i = 0;i < pad3.length; i++)
|
|
73903
|
+
pad3[i] ^= 54;
|
|
73904
|
+
this.iHash.update(pad3);
|
|
73905
|
+
this.oHash = hash2.create();
|
|
73906
|
+
for (let i = 0;i < pad3.length; i++)
|
|
73907
|
+
pad3[i] ^= 54 ^ 92;
|
|
73908
|
+
this.oHash.update(pad3);
|
|
73909
|
+
pad3.fill(0);
|
|
73910
|
+
}
|
|
73911
|
+
update(buf) {
|
|
73912
|
+
aexists(this);
|
|
73913
|
+
this.iHash.update(buf);
|
|
73914
|
+
return this;
|
|
73915
|
+
}
|
|
73916
|
+
digestInto(out) {
|
|
73917
|
+
aexists(this);
|
|
73918
|
+
abytes(out, this.outputLen);
|
|
73919
|
+
this.finished = true;
|
|
73920
|
+
this.iHash.digestInto(out);
|
|
73921
|
+
this.oHash.update(out);
|
|
73922
|
+
this.oHash.digestInto(out);
|
|
73923
|
+
this.destroy();
|
|
73924
|
+
}
|
|
73925
|
+
digest() {
|
|
73926
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
|
73927
|
+
this.digestInto(out);
|
|
73928
|
+
return out;
|
|
73929
|
+
}
|
|
73930
|
+
_cloneInto(to) {
|
|
73931
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
73932
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
73933
|
+
to = to;
|
|
73934
|
+
to.finished = finished;
|
|
73935
|
+
to.destroyed = destroyed;
|
|
73936
|
+
to.blockLen = blockLen;
|
|
73937
|
+
to.outputLen = outputLen;
|
|
73938
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
|
73939
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
|
73940
|
+
return to;
|
|
73941
|
+
}
|
|
73942
|
+
destroy() {
|
|
73943
|
+
this.destroyed = true;
|
|
73944
|
+
this.oHash.destroy();
|
|
73945
|
+
this.iHash.destroy();
|
|
73946
|
+
}
|
|
73947
|
+
}
|
|
73948
|
+
var hmac2 = (hash2, key, message) => new HMAC2(hash2, key).update(message).digest();
|
|
73949
|
+
hmac2.create = (hash2, key) => new HMAC2(hash2, key);
|
|
73950
|
+
|
|
73951
|
+
// ../../node_modules/@noble/hashes/esm/hkdf.js
|
|
73953
73952
|
function extract2(hash2, ikm, salt) {
|
|
73954
73953
|
ahash(hash2);
|
|
73955
73954
|
if (salt === undefined)
|
|
@@ -73985,7 +73984,11 @@ function expand(hash2, prk, info, length = 32) {
|
|
|
73985
73984
|
var hkdf = (hash2, ikm, salt, info, length) => expand(hash2, extract2(hash2, ikm, salt), info, length);
|
|
73986
73985
|
|
|
73987
73986
|
// src/crypto/aes.ts
|
|
73988
|
-
var {
|
|
73987
|
+
var {
|
|
73988
|
+
createECDH,
|
|
73989
|
+
createCipheriv,
|
|
73990
|
+
createDecipheriv
|
|
73991
|
+
} = require_crypto_browserify();
|
|
73989
73992
|
|
|
73990
73993
|
class AesGcmCrypto {
|
|
73991
73994
|
key;
|
|
@@ -74009,10 +74012,6 @@ class AesGcmCrypto {
|
|
|
74009
74012
|
}
|
|
74010
74013
|
return nonceBuffer;
|
|
74011
74014
|
}
|
|
74012
|
-
rlpEncodeInput(data) {
|
|
74013
|
-
const rlpEncoded = hexToRlp(data);
|
|
74014
|
-
return new Uint8Array(Buffer.from(rlpEncoded.slice(2), "hex"));
|
|
74015
|
-
}
|
|
74016
74015
|
validateAndConvertNonce(nonce) {
|
|
74017
74016
|
const nonceBuffer = Buffer.from(nonce.slice(2), "hex");
|
|
74018
74017
|
if (nonceBuffer.length !== this.NONCE_LENGTH) {
|
|
@@ -74025,11 +74024,11 @@ class AesGcmCrypto {
|
|
|
74025
74024
|
}
|
|
74026
74025
|
encrypt(plaintext, nonce) {
|
|
74027
74026
|
const nonceBuffer = new Uint8Array(typeof nonce === "string" ? this.validateAndConvertNonce(nonce) : this.numberToNonce(nonce));
|
|
74028
|
-
const rlpEncodedData = this.rlpEncodeInput(plaintext);
|
|
74029
74027
|
const key = new Uint8Array(Buffer.from(this.key.slice(2), "hex"));
|
|
74030
74028
|
const cipher = createCipheriv(this.ALGORITHM, key, nonceBuffer);
|
|
74029
|
+
const callData = new Uint8Array(Buffer.from(plaintext.slice(2), "hex"));
|
|
74031
74030
|
const ciphertext = Buffer.concat([
|
|
74032
|
-
new Uint8Array(cipher.update(
|
|
74031
|
+
new Uint8Array(cipher.update(callData)),
|
|
74033
74032
|
new Uint8Array(cipher.final()),
|
|
74034
74033
|
new Uint8Array(cipher.getAuthTag())
|
|
74035
74034
|
]);
|
|
@@ -74049,8 +74048,7 @@ class AesGcmCrypto {
|
|
|
74049
74048
|
new Uint8Array(decipher.update(encryptedData)),
|
|
74050
74049
|
new Uint8Array(decipher.final())
|
|
74051
74050
|
]));
|
|
74052
|
-
|
|
74053
|
-
return `0x${decoded.toString("hex")}`;
|
|
74051
|
+
return `0x${Buffer.from(decrypted).toString("hex")}`;
|
|
74054
74052
|
}
|
|
74055
74053
|
}
|
|
74056
74054
|
var generateSharedKey = ({
|
|
@@ -10,6 +10,7 @@ type SignedReadContractReturnType<TAbi extends Abi | readonly unknown[], TClient
|
|
|
10
10
|
[functionName in _readFunctionNames]: GetReadFunction<_narrowable, TAbi, functionName extends ContractFunctionName<TAbi, 'pure' | 'view'> ? functionName : never>;
|
|
11
11
|
};
|
|
12
12
|
} : unknown;
|
|
13
|
-
export
|
|
13
|
+
export type ShieldedContract<TTransport extends Transport, TAddress extends Address, TAbi extends Abi | readonly unknown[], TClient extends ShieldedWalletClient<TTransport, TChain, TAccount> | KeyedClient<TTransport, TChain, TAccount>, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined> = GetContractReturnType<TAbi, TClient, TAddress> & SignedReadContractReturnType<TAbi, TClient>;
|
|
14
|
+
export declare function getShieldedContract<TTransport extends Transport, TAddress extends Address, const TAbi extends Abi | readonly unknown[], const TClient extends ShieldedWalletClient<TTransport, TChain, TAccount> | KeyedClient<TTransport, TChain, TAccount>, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>({ abi, address, client, }: GetContractParameters<TTransport, TChain, TAccount, TAbi, TClient, TAddress>): ShieldedContract<TTransport, TAddress, TAbi, TClient, TChain, TAccount>;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -11,11 +11,6 @@ export declare class AesGcmCrypto {
|
|
|
11
11
|
* @param num - The number to convert (will be treated as u64)
|
|
12
12
|
*/
|
|
13
13
|
private numberToNonce;
|
|
14
|
-
/**
|
|
15
|
-
* RLP encodes the input data
|
|
16
|
-
* @param data - The hex data to encode
|
|
17
|
-
*/
|
|
18
|
-
private rlpEncodeInput;
|
|
19
14
|
/**
|
|
20
15
|
* Validates and converts a hex nonce to buffer
|
|
21
16
|
* @param nonce - The nonce in hex format
|
package/dist/_types/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export { signedReadContract } from './contract/read';
|
|
|
6
6
|
export { shieldedWriteContract } from './contract/write';
|
|
7
7
|
export { createShieldedPublicClient, createShieldedWalletClient, } from './client';
|
|
8
8
|
export type { ShieldedPublicClient, ShieldedWalletClient } from './client';
|
|
9
|
+
export type { ShieldedContract } from './contract/contract';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seismic-viem",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Typescript interface for Seismic",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/_cjs/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
23
|
"clean": "rimraf dist",
|
|
24
|
-
"typecheck": "tsc --noEmit
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
25
|
"build": "bun build:cjs && bun build:esm && bun build:types",
|
|
26
26
|
"build:cjs": "bun build src/index.ts --outdir dist/_cjs --target browser --format cjs",
|
|
27
27
|
"build:esm": "bun build src/index.ts --outdir dist/_esm --target browser --format esm",
|
|
@@ -29,12 +29,11 @@
|
|
|
29
29
|
"postbuild": "rimraf ./dist/tsconfig.types.tsbuildinfo"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"viem": "^2.21.50"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"eslint-config-prettier": "^9.1.0",
|
|
36
|
-
"eslint-plugin-no-relative-import-paths": "^1.5.5"
|
|
32
|
+
"viem": "^2.21.50",
|
|
33
|
+
"crypto-browserify": "^3.12.1",
|
|
34
|
+
"noble": "^1.9.1"
|
|
37
35
|
},
|
|
36
|
+
"devDependencies": {},
|
|
38
37
|
"license": "MIT",
|
|
39
38
|
"author": "Seismic Systems",
|
|
40
39
|
"homepage": "https://seismic.systems",
|
|
@@ -50,4 +49,4 @@
|
|
|
50
49
|
"web3",
|
|
51
50
|
"typescript"
|
|
52
51
|
]
|
|
53
|
-
}
|
|
52
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=crypto-loader.d.ts.map
|