Skip to content

Commit 69610eb

Browse files
committed
Add missing ramtransfer opteration
ramtransfer operation added in march introduced to beeteos
1 parent b9decb2 commit 69610eb

File tree

13 files changed

+234
-42
lines changed

13 files changed

+234
-42
lines changed

src/lib/blockchains/EOS/beautify.js

+65-39
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,20 @@ const allowedOperations = [
4444
"rmvproducer",
4545
"updtrevision",
4646
"bidname",
47-
"bidrefund"
47+
"bidrefund",
48+
"ramtransfer",
4849
];
4950

5051
/**
5152
* Convert an array of operations into a readable format
52-
* @param {Object} operation
53-
* @returns
53+
* @param {Object} operation
54+
* @returns
5455
*/
55-
export default async function beautify (operation) {
56+
export default async function beautify(operation) {
5657
if (!operation || !operation.name) {
5758
return;
5859
}
59-
60+
6061
const opType = operation.name;
6162

6263
if (!allowedOperations.includes(opType)) {
@@ -74,9 +75,9 @@ export default async function beautify (operation) {
7475
if (opType === "transfer") {
7576
/**
7677
* Transferring tokens action.
77-
*
78+
*
7879
* @details Transfer tokens from account to account.
79-
*
80+
*
8081
* @param from - the account to transfer from,
8182
* @param to - the account to be transferred to,
8283
* @param quantity - the quantity of tokens to be transferred,
@@ -92,7 +93,6 @@ export default async function beautify (operation) {
9293
{ key: "quantity", params: { quantity: quantity } },
9394
{ key: "memo", params: { memo: memo ?? "" } },
9495
];
95-
9696
} else if (opType === "setalimits") {
9797
/**
9898
* Set account limits action.
@@ -169,7 +169,10 @@ export default async function beautify (operation) {
169169
*/
170170
const feature_digest = operation.data.feature_digest;
171171
currentOperation["rows"] = [
172-
{ key: "feature_digest", params: { feature_digest: feature_digest } },
172+
{
173+
key: "feature_digest",
174+
params: { feature_digest: feature_digest },
175+
},
173176
];
174177
} else if (opType === "delegatebw") {
175178
// functions defined in delegate_bandwidth.cpp
@@ -197,11 +200,16 @@ export default async function beautify (operation) {
197200
currentOperation["rows"] = [
198201
{ key: "from", params: { from: from } },
199202
{ key: "receiver", params: { receiver: receiver } },
200-
{ key: "stake_net_quantity", params: { stake_net_quantity: stake_net_quantity } },
201-
{ key: "stake_cpu_quantity", params: { stake_cpu_quantity: stake_cpu_quantity } },
203+
{
204+
key: "stake_net_quantity",
205+
params: { stake_net_quantity: stake_net_quantity },
206+
},
207+
{
208+
key: "stake_cpu_quantity",
209+
params: { stake_cpu_quantity: stake_cpu_quantity },
210+
},
202211
{ key: "transfer", params: { transfer: transfer } },
203212
];
204-
205213
} else if (opType === "setrex") {
206214
/**
207215
* Setrex action.
@@ -333,9 +341,7 @@ export default async function beautify (operation) {
333341
* @pre Order cannot be cancelled once it's been filled.
334342
*/
335343
const owner = operation.data.owner;
336-
currentOperation["rows"] = [
337-
{ key: "owner", params: { owner: owner } },
338-
];
344+
currentOperation["rows"] = [{ key: "owner", params: { owner: owner } }];
339345
} else if (opType === "rentcpu") {
340346
/**
341347
* Rentcpu action.
@@ -469,7 +475,7 @@ export default async function beautify (operation) {
469475
{ key: "from", params: { from: from } },
470476
{ key: "loan_num", params: { loan_num: loan_num } },
471477
{ key: "amount", params: { amount: amount } },
472-
];
478+
];
473479
} else if (opType === "updaterex") {
474480
/**
475481
* Updaterex action.
@@ -478,11 +484,9 @@ export default async function beautify (operation) {
478484
*
479485
* @param owner - REX owner account.
480486
*/
481-
487+
482488
const owner = operation.data.owner;
483-
currentOperation["rows"] = [
484-
{ key: "owner", params: { owner: owner } },
485-
];
489+
currentOperation["rows"] = [{ key: "owner", params: { owner: owner } }];
486490
} else if (opType === "rexexec") {
487491
/**
488492
* Rexexec action.
@@ -509,9 +513,7 @@ export default async function beautify (operation) {
509513
* @param owner - REX owner account name.
510514
*/
511515
const owner = operation.data.owner;
512-
currentOperation["rows"] = [
513-
{ key: "owner", params: { owner: owner } },
514-
];
516+
currentOperation["rows"] = [{ key: "owner", params: { owner: owner } }];
515517
} else if (opType === "mvtosavings") {
516518
/**
517519
* Mvtosavings action.
@@ -561,9 +563,7 @@ export default async function beautify (operation) {
561563
* REX fund entry is deleted.
562564
*/
563565
const owner = operation.data.owner;
564-
currentOperation["rows"] = [
565-
{ key: "owner", params: { owner: owner } },
566-
];
566+
currentOperation["rows"] = [{ key: "owner", params: { owner: owner } }];
567567
} else if (opType === "undelegatebw") {
568568
/**
569569
* Undelegate bandwitdh action.
@@ -601,8 +601,14 @@ export default async function beautify (operation) {
601601
currentOperation["rows"] = [
602602
{ key: "from", params: { from: from } },
603603
{ key: "receiver", params: { receiver: receiver } },
604-
{ key: "unstake_net_quantity", params: { unstake_net_quantity: unstake_net_quantity } },
605-
{ key: "unstake_cpu_quantity", params: { unstake_cpu_quantity: unstake_cpu_quantity } },
604+
{
605+
key: "unstake_net_quantity",
606+
params: { unstake_net_quantity: unstake_net_quantity },
607+
},
608+
{
609+
key: "unstake_cpu_quantity",
610+
params: { unstake_cpu_quantity: unstake_cpu_quantity },
611+
},
606612
];
607613
} else if (opType === "buyram") {
608614
/**
@@ -669,9 +675,7 @@ export default async function beautify (operation) {
669675
* @param owner - the owner of the tokens claimed.
670676
*/
671677
const owner = operation.data.owner;
672-
currentOperation["rows"] = [
673-
{ key: "owner", params: { owner: owner } },
674-
];
678+
currentOperation["rows"] = [{ key: "owner", params: { owner: owner } }];
675679
} else if (opType === "regproducer") {
676680
// functions defined in voting.cpp
677681

@@ -711,7 +715,7 @@ export default async function beautify (operation) {
711715
const producer = operation.data.producer;
712716
currentOperation["rows"] = [
713717
{ key: "producer", params: { producer: producer } },
714-
];
718+
];
715719
} else if (opType === "setram") {
716720
/**
717721
* Set ram action.
@@ -735,7 +739,10 @@ export default async function beautify (operation) {
735739
*/
736740
const bytes_per_block = operation.data.bytes_per_block;
737741
currentOperation["rows"] = [
738-
{ key: "bytes_per_block", params: { bytes_per_block: bytes_per_block } },
742+
{
743+
key: "bytes_per_block",
744+
params: { bytes_per_block: bytes_per_block },
745+
},
739746
];
740747
} else if (opType === "voteproducer") {
741748
/**
@@ -770,7 +777,7 @@ export default async function beautify (operation) {
770777
{ key: "voter", params: { voter: voter } },
771778
{ key: "proxy", params: { proxy: proxy } },
772779
{ key: "producers", params: { producers: producers } },
773-
];
780+
];
774781
} else if (opType === "regproxy") {
775782
/**
776783
* Register proxy action.
@@ -803,7 +810,10 @@ export default async function beautify (operation) {
803810
*/
804811
const params = JSON.stringify(operation.data.params, null, 2);
805812
currentOperation["rows"] = [
806-
{ key: "params", params: { params: JSON.stringify(params, null, 2) } },
813+
{
814+
key: "params",
815+
params: { params: JSON.stringify(params, null, 2) },
816+
},
807817
];
808818
} else if (opType === "claimrewards") {
809819
// functions defined in producer_pay.cpp
@@ -814,9 +824,7 @@ export default async function beautify (operation) {
814824
* @param owner - producer account claiming per-block and per-vote rewards.
815825
*/
816826
const owner = operation.data.owner;
817-
currentOperation["rows"] = [
818-
{ key: "owner", params: { owner: owner } },
819-
];
827+
currentOperation["rows"] = [{ key: "owner", params: { owner: owner } }];
820828
} else if (opType === "setpriv") {
821829
/**
822830
* Set privilege status for an account.
@@ -898,7 +906,25 @@ export default async function beautify (operation) {
898906
{ key: "bidder", params: { bidder: bidder } },
899907
{ key: "newname", params: { newname: newname } },
900908
];
909+
} else if (opType === "ramtransfer") {
910+
/**
911+
* Ram transfer action.
912+
*
913+
* @details Allows an account `from` to transfer ram to another account `to`.
914+
*
915+
* @param from - the account sending ram,
916+
* @param to - the account receiving ram,
917+
* @param bytes - the amount of ram to be sent.
918+
*/
919+
const from = operation.data.from;
920+
const to = operation.data.to;
921+
const bytes = operation.data.bytes;
922+
currentOperation["rows"] = [
923+
{ key: "from", params: { from: from } },
924+
{ key: "to", params: { to: to } },
925+
{ key: "bytes", params: { bytes: bytes } },
926+
];
901927
}
902928

903929
return currentOperation;
904-
}
930+
}

src/lib/blockchains/EOSmainnet.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ const operations = [
5858
"rmvproducer",
5959
"updtrevision",
6060
"bidname",
61-
"bidrefund"
61+
"bidrefund",
62+
"ramtransfer"
6263
];
6364

6465
export default class EOS extends BlockchainAPI {

src/translations/operations/da.json

+15
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,21 @@
22252225
"newname": "Nyt navn: {newname}"
22262226
},
22272227
"tooltip": "Tilbagebetaling af budoperation"
2228+
},
2229+
"ramtransfer": {
2230+
"method": "RAM-overførsel",
2231+
"title": "RAM-overførselsanmodning",
2232+
"result": "Resultat af RAM-overførsel",
2233+
"headers": {
2234+
"request": "Overføre RAM fra en konto til en anden?",
2235+
"result": "RAM blev overført fra en konto til en anden:"
2236+
},
2237+
"rows": {
2238+
"from": "Fra: {from}",
2239+
"to": "Til: {to}",
2240+
"bytes": "Bytes: {bytes}"
2241+
},
2242+
"tooltip": "Overførsel af RAM-drift"
22282243
}
22292244
}
22302245
}

src/translations/operations/de.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,22 @@
22252225
"newname": "Neuer Name: {newname}"
22262226
},
22272227
"tooltip": "Rückerstattung des Gebotsvorgangs"
2228-
}
2228+
},
2229+
"ramtransfer": {
2230+
"method": "RAM-Übertragung",
2231+
"title": "RAM-Übertragungsanforderung",
2232+
"result": "RAM-Übertragungsergebnis",
2233+
"headers": {
2234+
"request": "RAM von einem Konto auf ein anderes übertragen?",
2235+
"result": "RAM wurde von einem Konto auf ein anderes übertragen:"
2236+
},
2237+
"rows": {
2238+
"from": "Von: {von}",
2239+
"to": "An: {an}",
2240+
"bytes": "Bytes: {Bytes}"
2241+
},
2242+
"tooltip": "RAM-Betrieb übertragen"
2243+
}
22292244
}
22302245
}
22312246
}

src/translations/operations/en.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,22 @@
787787
"newname": "New Name: {newname}"
788788
},
789789
"tooltip": "Refunding Bid operation"
790-
}
790+
},
791+
"ramtransfer": {
792+
"method": "RAM Transfer",
793+
"title": "RAM Transfer Request",
794+
"result": "RAM Transfer Result",
795+
"headers": {
796+
"request": "Transfer RAM from one account to another?",
797+
"result": "RAM was transferred from one account to another:"
798+
},
799+
"rows": {
800+
"from": "From: {from}",
801+
"to": "To: {to}",
802+
"bytes": "Bytes: {bytes}"
803+
},
804+
"tooltip": "Transferring RAM operation"
805+
}
791806
},
792807
"BTS": {
793808
"getAccount": {

src/translations/operations/es.json

+15
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,21 @@
22252225
"newname": "Nuevo nombre: {newname}"
22262226
},
22272227
"tooltip": "Operación de oferta de reembolso"
2228+
},
2229+
"ramtransfer": {
2230+
"method": "Transferencia de RAM",
2231+
"title": "Solicitud de transferencia de RAM",
2232+
"result": "Resultado de la transferencia de RAM",
2233+
"headers": {
2234+
"request": "¿Transferir RAM de una cuenta a otra?",
2235+
"result": "La RAM se transfirió de una cuenta a otra:"
2236+
},
2237+
"rows": {
2238+
"from": "De: {de}",
2239+
"to": "Para: {a}",
2240+
"bytes": "Bytes: {bytes}"
2241+
},
2242+
"tooltip": "Operación de transferencia de RAM"
22282243
}
22292244
}
22302245
}

src/translations/operations/et.json

+15
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,21 @@
22252225
"newname": "Uus nimi: {newname}"
22262226
},
22272227
"tooltip": "Pakkumise tagasimakse toiming"
2228+
},
2229+
"ramtransfer": {
2230+
"method": "RAM-i ülekanne",
2231+
"title": "RAM-i ülekande taotlus",
2232+
"result": "RAM-i ülekande tulemus",
2233+
"headers": {
2234+
"request": "Kas teisaldada RAM-i ühelt kontolt teisele?",
2235+
"result": "RAM kanti ühelt kontolt teisele:"
2236+
},
2237+
"rows": {
2238+
"from": "Saatja: {from}",
2239+
"to": "Saaja: {to}",
2240+
"bytes": "Baidid: {baiti}"
2241+
},
2242+
"tooltip": "RAM-i toimingute edastamine"
22282243
}
22292244
}
22302245
}

src/translations/operations/fr.json

+15
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,21 @@
22252225
"newname": "Nouveau nom : {newname}"
22262226
},
22272227
"tooltip": "Opération d’offre de remboursement"
2228+
},
2229+
"ramtransfer": {
2230+
"method": "Transfert de RAM",
2231+
"title": "Demande de transfert de RAM",
2232+
"result": "Résultat du transfert de RAM",
2233+
"headers": {
2234+
"request": "Transférer de la RAM d'un compte à un autre ?",
2235+
"result": "La RAM a été transférée d'un compte à un autre :"
2236+
},
2237+
"rows": {
2238+
"from": "De : {de}",
2239+
"to": "À : {à}",
2240+
"bytes": "Octets : {octets}"
2241+
},
2242+
"tooltip": "Opération de transfert de RAM"
22282243
}
22292244
}
22302245
}

0 commit comments

Comments
 (0)