@t2000/sdk 0.1.9 → 0.2.0
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/index.cjs +4 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -721,11 +721,11 @@ function solveHashcash(challenge) {
|
|
|
721
721
|
}
|
|
722
722
|
|
|
723
723
|
// src/gas/gasStation.ts
|
|
724
|
-
async function requestGasSponsorship(
|
|
724
|
+
async function requestGasSponsorship(txJson, sender, type) {
|
|
725
725
|
const res = await fetch(`${API_BASE_URL}/api/gas`, {
|
|
726
726
|
method: "POST",
|
|
727
727
|
headers: { "Content-Type": "application/json" },
|
|
728
|
-
body: JSON.stringify({
|
|
728
|
+
body: JSON.stringify({ txJson, sender, type })
|
|
729
729
|
});
|
|
730
730
|
const data = await res.json();
|
|
731
731
|
if (!res.ok) {
|
|
@@ -796,8 +796,7 @@ async function executeAutoTopUp(client, keypair) {
|
|
|
796
796
|
amount: topupAmountHuman
|
|
797
797
|
});
|
|
798
798
|
const txJson = tx.serialize();
|
|
799
|
-
const
|
|
800
|
-
const sponsoredResult = await requestGasSponsorship(txBytesBase64, address, "auto-topup");
|
|
799
|
+
const sponsoredResult = await requestGasSponsorship(txJson, address, "auto-topup");
|
|
801
800
|
const sponsoredTxBytes = Buffer.from(sponsoredResult.txBytes, "base64");
|
|
802
801
|
const { signature: agentSig } = await keypair.signTransaction(sponsoredTxBytes);
|
|
803
802
|
const result = await client.executeTransactionBlock({
|
|
@@ -873,8 +872,7 @@ async function trySponsored(client, keypair, tx) {
|
|
|
873
872
|
const address = keypair.getPublicKey().toSuiAddress();
|
|
874
873
|
tx.setSender(address);
|
|
875
874
|
const txJson = tx.serialize();
|
|
876
|
-
const
|
|
877
|
-
const sponsoredResult = await requestGasSponsorship(txBytesBase64, address);
|
|
875
|
+
const sponsoredResult = await requestGasSponsorship(txJson, address);
|
|
878
876
|
const sponsoredTxBytes = Buffer.from(sponsoredResult.txBytes, "base64");
|
|
879
877
|
const { signature: agentSig } = await keypair.signTransaction(sponsoredTxBytes);
|
|
880
878
|
const result = await client.executeTransactionBlock({
|