@@ -47,11 +47,19 @@ void MetaGroupWrapper::Init(Napi::Env env, Napi::Object exports) {
4747 InstanceMethod (
4848 " membersMarkPendingRemoval" ,
4949 &MetaGroupWrapper::membersMarkPendingRemoval),
50- InstanceMethod (" memberSetName" , &MetaGroupWrapper::memberSetName),
50+ InstanceMethod (
51+ " memberSetNameTruncated" , &MetaGroupWrapper::memberSetNameTruncated),
5152 InstanceMethod (" memberSetInvited" , &MetaGroupWrapper::memberSetInvited),
5253 InstanceMethod (" memberSetAccepted" , &MetaGroupWrapper::memberSetAccepted),
5354 InstanceMethod (" memberSetPromoted" , &MetaGroupWrapper::memberSetPromoted),
54- InstanceMethod (" memberSetAdmin" , &MetaGroupWrapper::memberSetAdmin),
55+ InstanceMethod (
56+ " memberSetPromotionSent" , &MetaGroupWrapper::memberSetPromotionSent),
57+ InstanceMethod (
58+ " memberSetPromotionFailed" ,
59+ &MetaGroupWrapper::memberSetPromotionFailed),
60+ InstanceMethod (
61+ " memberSetPromotionAccepted" ,
62+ &MetaGroupWrapper::memberSetPromotionAccepted),
5563 InstanceMethod (
5664 " memberSetProfilePicture" , &MetaGroupWrapper::memberSetProfilePicture),
5765 InstanceMethod (" memberEraseAndRekey" , &MetaGroupWrapper::memberEraseAndRekey),
@@ -73,6 +81,7 @@ void MetaGroupWrapper::Init(Napi::Env env, Napi::Object exports) {
7381 InstanceMethod (
7482 " swarmVerifySubAccount" , &MetaGroupWrapper::swarmVerifySubAccount),
7583 InstanceMethod (" loadAdminKeys" , &MetaGroupWrapper::loadAdminKeys),
84+ InstanceMethod (" keysAdmin" , &MetaGroupWrapper::keysAdmin),
7685
7786 InstanceMethod (" swarmSubaccountSign" , &MetaGroupWrapper::swarmSubaccountSign),
7887 InstanceMethod (
@@ -431,7 +440,7 @@ void MetaGroupWrapper::memberConstructAndSet(const Napi::CallbackInfo& info) {
431440 });
432441}
433442
434- void MetaGroupWrapper::memberSetName (const Napi::CallbackInfo& info) {
443+ void MetaGroupWrapper::memberSetNameTruncated (const Napi::CallbackInfo& info) {
435444 wrapExceptions (info, [&] {
436445 assertIsString (info[0 ]);
437446 assertIsString (info[1 ]);
@@ -477,29 +486,51 @@ void MetaGroupWrapper::memberSetAccepted(const Napi::CallbackInfo& info) {
477486
478487void MetaGroupWrapper::memberSetPromoted (const Napi::CallbackInfo& info) {
479488 wrapExceptions (info, [&] {
480- assertInfoLength (info, 2 );
489+ assertInfoLength (info, 1 );
481490 assertIsString (info[0 ]);
482- assertIsBoolean (info[1 ]);
483491 auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
484- auto failed = toCppBoolean (info[1 ], __PRETTY_FUNCTION__);
485492 auto m = this ->meta_group ->members ->get (pubkeyHex);
486493 if (m) {
487- m->set_promoted (failed );
494+ m->set_promoted ();
488495 this ->meta_group ->members ->set (*m);
489496 }
490497 });
491498}
492499
493- void MetaGroupWrapper::memberSetAdmin (const Napi::CallbackInfo& info) {
500+ void MetaGroupWrapper::memberSetPromotionSent (const Napi::CallbackInfo& info) {
494501 wrapExceptions (info, [&] {
495502 assertInfoLength (info, 1 );
496503 assertIsString (info[0 ]);
497504 auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
498- // Note: this step might add an admin which was removed back once he accepts the promotion,
499- // but there is not much we can do about it
500505 auto m = this ->meta_group ->members ->get (pubkeyHex);
501506 if (m) {
502- m->admin = true ;
507+ m->set_promotion_sent ();
508+ this ->meta_group ->members ->set (*m);
509+ }
510+ });
511+ }
512+
513+ void MetaGroupWrapper::memberSetPromotionFailed (const Napi::CallbackInfo& info) {
514+ wrapExceptions (info, [&] {
515+ assertInfoLength (info, 1 );
516+ assertIsString (info[0 ]);
517+ auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
518+ auto m = this ->meta_group ->members ->get (pubkeyHex);
519+ if (m) {
520+ m->set_promotion_failed ();
521+ this ->meta_group ->members ->set (*m);
522+ }
523+ });
524+ }
525+
526+ void MetaGroupWrapper::memberSetPromotionAccepted (const Napi::CallbackInfo& info) {
527+ wrapExceptions (info, [&] {
528+ assertInfoLength (info, 1 );
529+ assertIsString (info[0 ]);
530+ auto pubkeyHex = toCppString (info[0 ], __PRETTY_FUNCTION__);
531+ auto m = this ->meta_group ->members ->get (pubkeyHex);
532+ if (m) {
533+ m->set_promotion_accepted ();
503534 this ->meta_group ->members ->set (*m);
504535 }
505536 });
@@ -703,7 +734,6 @@ Napi::Value MetaGroupWrapper::loadAdminKeys(const Napi::CallbackInfo& info) {
703734 });
704735}
705736
706-
707737Napi::Value MetaGroupWrapper::keysAdmin (const Napi::CallbackInfo& info) {
708738 return wrapResult (info, [&] {
709739 assertInfoLength (info, 0 );
0 commit comments