@sparkdreamnft/sparkdreamjs 0.0.39 → 0.0.41
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/esm/sparkdream/federation/v1/genesis.js +397 -2
- package/esm/sparkdream/federation/v1/params.js +68 -92
- package/esm/sparkdream/federation/v1/query.js +49 -1
- package/esm/sparkdream/federation/v1/query.lcd.js +13 -3
- package/esm/sparkdream/federation/v1/query.rpc.Query.js +1 -3
- package/esm/sparkdream/federation/v1/tx.js +14 -2
- package/esm/sparkdream/federation/v1/types.js +164 -20
- package/esm/sparkdream/session/v1/tx.amino.js +205 -3
- package/package.json +1 -1
- package/sparkdream/bundle.d.ts +114 -2
- package/sparkdream/client.d.ts +64 -0
- package/sparkdream/federation/v1/genesis.d.ts +221 -1
- package/sparkdream/federation/v1/genesis.js +397 -2
- package/sparkdream/federation/v1/params.d.ts +0 -4
- package/sparkdream/federation/v1/params.js +68 -92
- package/sparkdream/federation/v1/query.d.ts +30 -0
- package/sparkdream/federation/v1/query.js +49 -1
- package/sparkdream/federation/v1/query.lcd.d.ts +1 -1
- package/sparkdream/federation/v1/query.lcd.js +13 -3
- package/sparkdream/federation/v1/query.rpc.Query.d.ts +3 -3
- package/sparkdream/federation/v1/query.rpc.Query.js +1 -3
- package/sparkdream/federation/v1/tx.d.ts +15 -1
- package/sparkdream/federation/v1/tx.js +13 -1
- package/sparkdream/federation/v1/types.d.ts +142 -2
- package/sparkdream/federation/v1/types.js +165 -21
- package/sparkdream/rpc.query.d.ts +1 -1
- package/sparkdream/session/v1/tx.amino.d.ts +65 -0
- package/sparkdream/session/v1/tx.amino.js +204 -2
|
@@ -176,6 +176,30 @@ export var FederatedContentStatus;
|
|
|
176
176
|
FederatedContentStatus[FederatedContentStatus["FEDERATED_CONTENT_STATUS_DISPUTED"] = 4] = "FEDERATED_CONTENT_STATUS_DISPUTED";
|
|
177
177
|
FederatedContentStatus[FederatedContentStatus["FEDERATED_CONTENT_STATUS_CHALLENGED"] = 5] = "FEDERATED_CONTENT_STATUS_CHALLENGED";
|
|
178
178
|
FederatedContentStatus[FederatedContentStatus["FEDERATED_CONTENT_STATUS_REJECTED"] = 6] = "FEDERATED_CONTENT_STATUS_REJECTED";
|
|
179
|
+
/**
|
|
180
|
+
* FEDERATED_CONTENT_STATUS_UNRESOLVED - UNRESOLVED is system-assigned: the arbiter resolution window expired
|
|
181
|
+
* without quorum, so no finding was ever made about the content. It is
|
|
182
|
+
* terminal, deliberately excluded from MsgModerateContent (OpsComm
|
|
183
|
+
* moderates HIDDEN/ACTIVE/VERIFIED/REJECTED, not system states), and
|
|
184
|
+
* was chosen over reverting to PENDING_VERIFICATION because a revived
|
|
185
|
+
* record would have no VerificationWindow queue entry and a verification
|
|
186
|
+
* deadline already in the past — unverifiable and unreapable until
|
|
187
|
+
* content_ttl. Local state only: FederatedContentStatus never crosses
|
|
188
|
+
* the IBC wire (see packet_wire_compat_test.go).
|
|
189
|
+
*/
|
|
190
|
+
FederatedContentStatus[FederatedContentStatus["FEDERATED_CONTENT_STATUS_UNRESOLVED"] = 7] = "FEDERATED_CONTENT_STATUS_UNRESOLVED";
|
|
191
|
+
/**
|
|
192
|
+
* FEDERATED_CONTENT_STATUS_SUPERSEDED - SUPERSEDED is system-assigned: the submitting operator anchored a newer
|
|
193
|
+
* version of the same content_uri (an edit) while this record was still
|
|
194
|
+
* PENDING_VERIFICATION. The anchored version no longer exists at the
|
|
195
|
+
* source, so no verifier can ever confirm it; retiring it here keeps it
|
|
196
|
+
* out of the verification-expiry sweep, which would otherwise count it
|
|
197
|
+
* against an honest operator as unverified. Terminal and excluded from
|
|
198
|
+
* MsgModerateContent for the same reason as UNRESOLVED: moderating it
|
|
199
|
+
* could manufacture a VERIFIED status for bytes nobody verified. Local
|
|
200
|
+
* state only; never crosses the IBC wire.
|
|
201
|
+
*/
|
|
202
|
+
FederatedContentStatus[FederatedContentStatus["FEDERATED_CONTENT_STATUS_SUPERSEDED"] = 8] = "FEDERATED_CONTENT_STATUS_SUPERSEDED";
|
|
179
203
|
FederatedContentStatus[FederatedContentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
180
204
|
})(FederatedContentStatus || (FederatedContentStatus = {}));
|
|
181
205
|
export const FederatedContentStatusAmino = FederatedContentStatus;
|
|
@@ -202,6 +226,12 @@ export function federatedContentStatusFromJSON(object) {
|
|
|
202
226
|
case 6:
|
|
203
227
|
case "FEDERATED_CONTENT_STATUS_REJECTED":
|
|
204
228
|
return FederatedContentStatus.FEDERATED_CONTENT_STATUS_REJECTED;
|
|
229
|
+
case 7:
|
|
230
|
+
case "FEDERATED_CONTENT_STATUS_UNRESOLVED":
|
|
231
|
+
return FederatedContentStatus.FEDERATED_CONTENT_STATUS_UNRESOLVED;
|
|
232
|
+
case 8:
|
|
233
|
+
case "FEDERATED_CONTENT_STATUS_SUPERSEDED":
|
|
234
|
+
return FederatedContentStatus.FEDERATED_CONTENT_STATUS_SUPERSEDED;
|
|
205
235
|
case -1:
|
|
206
236
|
case "UNRECOGNIZED":
|
|
207
237
|
default:
|
|
@@ -224,6 +254,10 @@ export function federatedContentStatusToJSON(object) {
|
|
|
224
254
|
return "FEDERATED_CONTENT_STATUS_CHALLENGED";
|
|
225
255
|
case FederatedContentStatus.FEDERATED_CONTENT_STATUS_REJECTED:
|
|
226
256
|
return "FEDERATED_CONTENT_STATUS_REJECTED";
|
|
257
|
+
case FederatedContentStatus.FEDERATED_CONTENT_STATUS_UNRESOLVED:
|
|
258
|
+
return "FEDERATED_CONTENT_STATUS_UNRESOLVED";
|
|
259
|
+
case FederatedContentStatus.FEDERATED_CONTENT_STATUS_SUPERSEDED:
|
|
260
|
+
return "FEDERATED_CONTENT_STATUS_SUPERSEDED";
|
|
227
261
|
case FederatedContentStatus.UNRECOGNIZED:
|
|
228
262
|
default:
|
|
229
263
|
return "UNRECOGNIZED";
|
|
@@ -628,9 +662,9 @@ function createBasePeerPolicy() {
|
|
|
628
662
|
outboundRateLimitPerEpoch: BigInt(0),
|
|
629
663
|
allowReputationQueries: false,
|
|
630
664
|
acceptReputationAttestations: false,
|
|
631
|
-
maxTrustCredit: 0,
|
|
632
665
|
requireReview: false,
|
|
633
|
-
blockedIdentities: []
|
|
666
|
+
blockedIdentities: [],
|
|
667
|
+
contentHosts: []
|
|
634
668
|
};
|
|
635
669
|
}
|
|
636
670
|
/**
|
|
@@ -658,7 +692,7 @@ export const PeerPolicy = {
|
|
|
658
692
|
writer.uint32(40).uint64(message.inboundRateLimitPerEpoch);
|
|
659
693
|
}
|
|
660
694
|
if (message.outboundRateLimitPerEpoch !== BigInt(0)) {
|
|
661
|
-
writer.uint32(
|
|
695
|
+
writer.uint32(80).uint64(message.outboundRateLimitPerEpoch);
|
|
662
696
|
}
|
|
663
697
|
if (message.allowReputationQueries === true) {
|
|
664
698
|
writer.uint32(48).bool(message.allowReputationQueries);
|
|
@@ -666,14 +700,14 @@ export const PeerPolicy = {
|
|
|
666
700
|
if (message.acceptReputationAttestations === true) {
|
|
667
701
|
writer.uint32(56).bool(message.acceptReputationAttestations);
|
|
668
702
|
}
|
|
669
|
-
if (message.maxTrustCredit !== 0) {
|
|
670
|
-
writer.uint32(64).uint32(message.maxTrustCredit);
|
|
671
|
-
}
|
|
672
703
|
if (message.requireReview === true) {
|
|
673
|
-
writer.uint32(
|
|
704
|
+
writer.uint32(64).bool(message.requireReview);
|
|
674
705
|
}
|
|
675
706
|
for (const v of message.blockedIdentities) {
|
|
676
|
-
writer.uint32(
|
|
707
|
+
writer.uint32(74).string(v);
|
|
708
|
+
}
|
|
709
|
+
for (const v of message.contentHosts) {
|
|
710
|
+
writer.uint32(90).string(v);
|
|
677
711
|
}
|
|
678
712
|
return writer;
|
|
679
713
|
},
|
|
@@ -699,7 +733,7 @@ export const PeerPolicy = {
|
|
|
699
733
|
case 5:
|
|
700
734
|
message.inboundRateLimitPerEpoch = reader.uint64();
|
|
701
735
|
break;
|
|
702
|
-
case
|
|
736
|
+
case 10:
|
|
703
737
|
message.outboundRateLimitPerEpoch = reader.uint64();
|
|
704
738
|
break;
|
|
705
739
|
case 6:
|
|
@@ -709,14 +743,14 @@ export const PeerPolicy = {
|
|
|
709
743
|
message.acceptReputationAttestations = reader.bool();
|
|
710
744
|
break;
|
|
711
745
|
case 8:
|
|
712
|
-
message.maxTrustCredit = reader.uint32();
|
|
713
|
-
break;
|
|
714
|
-
case 9:
|
|
715
746
|
message.requireReview = reader.bool();
|
|
716
747
|
break;
|
|
717
|
-
case
|
|
748
|
+
case 9:
|
|
718
749
|
message.blockedIdentities.push(reader.string());
|
|
719
750
|
break;
|
|
751
|
+
case 11:
|
|
752
|
+
message.contentHosts.push(reader.string());
|
|
753
|
+
break;
|
|
720
754
|
default:
|
|
721
755
|
reader.skipType(tag & 7);
|
|
722
756
|
break;
|
|
@@ -734,9 +768,9 @@ export const PeerPolicy = {
|
|
|
734
768
|
message.outboundRateLimitPerEpoch = object.outboundRateLimitPerEpoch !== undefined && object.outboundRateLimitPerEpoch !== null ? BigInt(object.outboundRateLimitPerEpoch.toString()) : BigInt(0);
|
|
735
769
|
message.allowReputationQueries = object.allowReputationQueries ?? false;
|
|
736
770
|
message.acceptReputationAttestations = object.acceptReputationAttestations ?? false;
|
|
737
|
-
message.maxTrustCredit = object.maxTrustCredit ?? 0;
|
|
738
771
|
message.requireReview = object.requireReview ?? false;
|
|
739
772
|
message.blockedIdentities = object.blockedIdentities?.map(e => e) || [];
|
|
773
|
+
message.contentHosts = object.contentHosts?.map(e => e) || [];
|
|
740
774
|
return message;
|
|
741
775
|
},
|
|
742
776
|
fromAmino(object) {
|
|
@@ -761,13 +795,11 @@ export const PeerPolicy = {
|
|
|
761
795
|
if (object.accept_reputation_attestations !== undefined && object.accept_reputation_attestations !== null) {
|
|
762
796
|
message.acceptReputationAttestations = object.accept_reputation_attestations;
|
|
763
797
|
}
|
|
764
|
-
if (object.max_trust_credit !== undefined && object.max_trust_credit !== null) {
|
|
765
|
-
message.maxTrustCredit = object.max_trust_credit;
|
|
766
|
-
}
|
|
767
798
|
if (object.require_review !== undefined && object.require_review !== null) {
|
|
768
799
|
message.requireReview = object.require_review;
|
|
769
800
|
}
|
|
770
801
|
message.blockedIdentities = object.blocked_identities?.map(e => e) || [];
|
|
802
|
+
message.contentHosts = object.content_hosts?.map(e => e) || [];
|
|
771
803
|
return message;
|
|
772
804
|
},
|
|
773
805
|
toAmino(message) {
|
|
@@ -790,7 +822,6 @@ export const PeerPolicy = {
|
|
|
790
822
|
obj.outbound_rate_limit_per_epoch = message.outboundRateLimitPerEpoch !== BigInt(0) ? message.outboundRateLimitPerEpoch?.toString() : undefined;
|
|
791
823
|
obj.allow_reputation_queries = message.allowReputationQueries === false ? undefined : message.allowReputationQueries;
|
|
792
824
|
obj.accept_reputation_attestations = message.acceptReputationAttestations === false ? undefined : message.acceptReputationAttestations;
|
|
793
|
-
obj.max_trust_credit = message.maxTrustCredit === 0 ? undefined : message.maxTrustCredit;
|
|
794
825
|
obj.require_review = message.requireReview === false ? undefined : message.requireReview;
|
|
795
826
|
if (message.blockedIdentities) {
|
|
796
827
|
obj.blocked_identities = message.blockedIdentities.map(e => e);
|
|
@@ -798,6 +829,12 @@ export const PeerPolicy = {
|
|
|
798
829
|
else {
|
|
799
830
|
obj.blocked_identities = message.blockedIdentities;
|
|
800
831
|
}
|
|
832
|
+
if (message.contentHosts) {
|
|
833
|
+
obj.content_hosts = message.contentHosts.map(e => e);
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
obj.content_hosts = message.contentHosts;
|
|
837
|
+
}
|
|
801
838
|
return obj;
|
|
802
839
|
},
|
|
803
840
|
fromAminoMsg(object) {
|
|
@@ -1102,7 +1139,8 @@ function createBaseVerificationRecord() {
|
|
|
1102
1139
|
lastChallengeResolvedAt: BigInt(0),
|
|
1103
1140
|
challenger: "",
|
|
1104
1141
|
escrowedChallengeFee: "",
|
|
1105
|
-
pendingVerifierVerdict: 0
|
|
1142
|
+
pendingVerifierVerdict: 0,
|
|
1143
|
+
commitmentReleased: false
|
|
1106
1144
|
};
|
|
1107
1145
|
}
|
|
1108
1146
|
/**
|
|
@@ -1153,6 +1191,9 @@ export const VerificationRecord = {
|
|
|
1153
1191
|
if (message.pendingVerifierVerdict !== 0) {
|
|
1154
1192
|
writer.uint32(104).int32(message.pendingVerifierVerdict);
|
|
1155
1193
|
}
|
|
1194
|
+
if (message.commitmentReleased === true) {
|
|
1195
|
+
writer.uint32(112).bool(message.commitmentReleased);
|
|
1196
|
+
}
|
|
1156
1197
|
return writer;
|
|
1157
1198
|
},
|
|
1158
1199
|
decode(input, length) {
|
|
@@ -1201,6 +1242,9 @@ export const VerificationRecord = {
|
|
|
1201
1242
|
case 13:
|
|
1202
1243
|
message.pendingVerifierVerdict = reader.int32();
|
|
1203
1244
|
break;
|
|
1245
|
+
case 14:
|
|
1246
|
+
message.commitmentReleased = reader.bool();
|
|
1247
|
+
break;
|
|
1204
1248
|
default:
|
|
1205
1249
|
reader.skipType(tag & 7);
|
|
1206
1250
|
break;
|
|
@@ -1223,6 +1267,7 @@ export const VerificationRecord = {
|
|
|
1223
1267
|
message.challenger = object.challenger ?? "";
|
|
1224
1268
|
message.escrowedChallengeFee = object.escrowedChallengeFee ?? "";
|
|
1225
1269
|
message.pendingVerifierVerdict = object.pendingVerifierVerdict ?? 0;
|
|
1270
|
+
message.commitmentReleased = object.commitmentReleased ?? false;
|
|
1226
1271
|
return message;
|
|
1227
1272
|
},
|
|
1228
1273
|
fromAmino(object) {
|
|
@@ -1266,6 +1311,9 @@ export const VerificationRecord = {
|
|
|
1266
1311
|
if (object.pending_verifier_verdict !== undefined && object.pending_verifier_verdict !== null) {
|
|
1267
1312
|
message.pendingVerifierVerdict = object.pending_verifier_verdict;
|
|
1268
1313
|
}
|
|
1314
|
+
if (object.commitment_released !== undefined && object.commitment_released !== null) {
|
|
1315
|
+
message.commitmentReleased = object.commitment_released;
|
|
1316
|
+
}
|
|
1269
1317
|
return message;
|
|
1270
1318
|
},
|
|
1271
1319
|
toAmino(message) {
|
|
@@ -1283,6 +1331,7 @@ export const VerificationRecord = {
|
|
|
1283
1331
|
obj.challenger = message.challenger === "" ? undefined : message.challenger;
|
|
1284
1332
|
obj.escrowed_challenge_fee = message.escrowedChallengeFee === "" ? undefined : message.escrowedChallengeFee;
|
|
1285
1333
|
obj.pending_verifier_verdict = message.pendingVerifierVerdict === 0 ? undefined : message.pendingVerifierVerdict;
|
|
1334
|
+
obj.commitment_released = message.commitmentReleased === false ? undefined : message.commitmentReleased;
|
|
1286
1335
|
return obj;
|
|
1287
1336
|
},
|
|
1288
1337
|
fromAminoMsg(object) {
|
|
@@ -1559,7 +1608,9 @@ function createBaseFederatedContent() {
|
|
|
1559
1608
|
submittedBy: "",
|
|
1560
1609
|
status: 0,
|
|
1561
1610
|
expiresAt: BigInt(0),
|
|
1562
|
-
contentHash: new Uint8Array()
|
|
1611
|
+
contentHash: new Uint8Array(),
|
|
1612
|
+
supersedes: undefined,
|
|
1613
|
+
supersededBy: BigInt(0)
|
|
1563
1614
|
};
|
|
1564
1615
|
}
|
|
1565
1616
|
/**
|
|
@@ -1619,6 +1670,12 @@ export const FederatedContent = {
|
|
|
1619
1670
|
if (message.contentHash.length !== 0) {
|
|
1620
1671
|
writer.uint32(130).bytes(message.contentHash);
|
|
1621
1672
|
}
|
|
1673
|
+
if (message.supersedes !== undefined) {
|
|
1674
|
+
ContentRef.encode(message.supersedes, writer.uint32(138).fork()).ldelim();
|
|
1675
|
+
}
|
|
1676
|
+
if (message.supersededBy !== BigInt(0)) {
|
|
1677
|
+
writer.uint32(144).uint64(message.supersededBy);
|
|
1678
|
+
}
|
|
1622
1679
|
return writer;
|
|
1623
1680
|
},
|
|
1624
1681
|
decode(input, length) {
|
|
@@ -1676,6 +1733,12 @@ export const FederatedContent = {
|
|
|
1676
1733
|
case 16:
|
|
1677
1734
|
message.contentHash = reader.bytes();
|
|
1678
1735
|
break;
|
|
1736
|
+
case 17:
|
|
1737
|
+
message.supersedes = ContentRef.decode(reader, reader.uint32());
|
|
1738
|
+
break;
|
|
1739
|
+
case 18:
|
|
1740
|
+
message.supersededBy = reader.uint64();
|
|
1741
|
+
break;
|
|
1679
1742
|
default:
|
|
1680
1743
|
reader.skipType(tag & 7);
|
|
1681
1744
|
break;
|
|
@@ -1701,6 +1764,8 @@ export const FederatedContent = {
|
|
|
1701
1764
|
message.status = object.status ?? 0;
|
|
1702
1765
|
message.expiresAt = object.expiresAt !== undefined && object.expiresAt !== null ? BigInt(object.expiresAt.toString()) : BigInt(0);
|
|
1703
1766
|
message.contentHash = object.contentHash ?? new Uint8Array();
|
|
1767
|
+
message.supersedes = object.supersedes !== undefined && object.supersedes !== null ? ContentRef.fromPartial(object.supersedes) : undefined;
|
|
1768
|
+
message.supersededBy = object.supersededBy !== undefined && object.supersededBy !== null ? BigInt(object.supersededBy.toString()) : BigInt(0);
|
|
1704
1769
|
return message;
|
|
1705
1770
|
},
|
|
1706
1771
|
fromAmino(object) {
|
|
@@ -1753,6 +1818,12 @@ export const FederatedContent = {
|
|
|
1753
1818
|
if (object.content_hash !== undefined && object.content_hash !== null) {
|
|
1754
1819
|
message.contentHash = bytesFromBase64(object.content_hash);
|
|
1755
1820
|
}
|
|
1821
|
+
if (object.supersedes !== undefined && object.supersedes !== null) {
|
|
1822
|
+
message.supersedes = ContentRef.fromAmino(object.supersedes);
|
|
1823
|
+
}
|
|
1824
|
+
if (object.superseded_by !== undefined && object.superseded_by !== null) {
|
|
1825
|
+
message.supersededBy = BigInt(object.superseded_by);
|
|
1826
|
+
}
|
|
1756
1827
|
return message;
|
|
1757
1828
|
},
|
|
1758
1829
|
toAmino(message) {
|
|
@@ -1773,6 +1844,8 @@ export const FederatedContent = {
|
|
|
1773
1844
|
obj.status = message.status === 0 ? undefined : message.status;
|
|
1774
1845
|
obj.expires_at = message.expiresAt !== BigInt(0) ? message.expiresAt?.toString() : undefined;
|
|
1775
1846
|
obj.content_hash = message.contentHash ? base64FromBytes(message.contentHash) : undefined;
|
|
1847
|
+
obj.supersedes = message.supersedes ? ContentRef.toAmino(message.supersedes) : undefined;
|
|
1848
|
+
obj.superseded_by = message.supersededBy !== BigInt(0) ? message.supersededBy?.toString() : undefined;
|
|
1776
1849
|
return obj;
|
|
1777
1850
|
},
|
|
1778
1851
|
fromAminoMsg(object) {
|
|
@@ -1791,6 +1864,77 @@ export const FederatedContent = {
|
|
|
1791
1864
|
};
|
|
1792
1865
|
}
|
|
1793
1866
|
};
|
|
1867
|
+
function createBaseContentRef() {
|
|
1868
|
+
return {
|
|
1869
|
+
contentId: BigInt(0)
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
/**
|
|
1873
|
+
* ContentRef points at a FederatedContent record. A message rather than a
|
|
1874
|
+
* bare uint64 because content ids start at 0: a nil ref is "none", which
|
|
1875
|
+
* a zero id could not express.
|
|
1876
|
+
* @name ContentRef
|
|
1877
|
+
* @package sparkdream.federation.v1
|
|
1878
|
+
* @see proto type: sparkdream.federation.v1.ContentRef
|
|
1879
|
+
*/
|
|
1880
|
+
export const ContentRef = {
|
|
1881
|
+
typeUrl: "/sparkdream.federation.v1.ContentRef",
|
|
1882
|
+
encode(message, writer = BinaryWriter.create()) {
|
|
1883
|
+
if (message.contentId !== BigInt(0)) {
|
|
1884
|
+
writer.uint32(8).uint64(message.contentId);
|
|
1885
|
+
}
|
|
1886
|
+
return writer;
|
|
1887
|
+
},
|
|
1888
|
+
decode(input, length) {
|
|
1889
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1890
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1891
|
+
const message = createBaseContentRef();
|
|
1892
|
+
while (reader.pos < end) {
|
|
1893
|
+
const tag = reader.uint32();
|
|
1894
|
+
switch (tag >>> 3) {
|
|
1895
|
+
case 1:
|
|
1896
|
+
message.contentId = reader.uint64();
|
|
1897
|
+
break;
|
|
1898
|
+
default:
|
|
1899
|
+
reader.skipType(tag & 7);
|
|
1900
|
+
break;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return message;
|
|
1904
|
+
},
|
|
1905
|
+
fromPartial(object) {
|
|
1906
|
+
const message = createBaseContentRef();
|
|
1907
|
+
message.contentId = object.contentId !== undefined && object.contentId !== null ? BigInt(object.contentId.toString()) : BigInt(0);
|
|
1908
|
+
return message;
|
|
1909
|
+
},
|
|
1910
|
+
fromAmino(object) {
|
|
1911
|
+
const message = createBaseContentRef();
|
|
1912
|
+
if (object.content_id !== undefined && object.content_id !== null) {
|
|
1913
|
+
message.contentId = BigInt(object.content_id);
|
|
1914
|
+
}
|
|
1915
|
+
return message;
|
|
1916
|
+
},
|
|
1917
|
+
toAmino(message) {
|
|
1918
|
+
const obj = {};
|
|
1919
|
+
obj.content_id = message.contentId !== BigInt(0) ? message.contentId?.toString() : undefined;
|
|
1920
|
+
return obj;
|
|
1921
|
+
},
|
|
1922
|
+
fromAminoMsg(object) {
|
|
1923
|
+
return ContentRef.fromAmino(object.value);
|
|
1924
|
+
},
|
|
1925
|
+
fromProtoMsg(message) {
|
|
1926
|
+
return ContentRef.decode(message.value);
|
|
1927
|
+
},
|
|
1928
|
+
toProto(message) {
|
|
1929
|
+
return ContentRef.encode(message).finish();
|
|
1930
|
+
},
|
|
1931
|
+
toProtoMsg(message) {
|
|
1932
|
+
return {
|
|
1933
|
+
typeUrl: "/sparkdream.federation.v1.ContentRef",
|
|
1934
|
+
value: ContentRef.encode(message).finish()
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1794
1938
|
function createBaseIdentityLink() {
|
|
1795
1939
|
return {
|
|
1796
1940
|
localAddress: "",
|
|
@@ -2,13 +2,155 @@
|
|
|
2
2
|
// HAND-WRITTEN OVERRIDE — overlaid by scripts/codegen.ts after telescope.
|
|
3
3
|
// See ../../commons/v1/tx.amino.ts for rationale.
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
5
|
+
// Because this file replaces the generated one wholesale, EVERY Msg in
|
|
6
|
+
// session/v1/tx.proto must have an entry here — a message added to the proto
|
|
7
|
+
// but not to this map ships in the registry with no amino converter, and
|
|
8
|
+
// Keplr/Ledger (amino-json) signing of it fails.
|
|
9
|
+
//
|
|
10
|
+
// Three shapes telescope gets wrong for this module:
|
|
11
|
+
//
|
|
12
|
+
// 1. MsgExecSession / OneshotExec carry google.protobuf.Any, which needs the
|
|
13
|
+
// recursive conversion in ../../../nested-amino.
|
|
14
|
+
// 2. MsgCreateGrant.payload and ScheduledOneshotPayload.action are oneofs
|
|
15
|
+
// with (amino.oneof_name). cosmossdk.io/x/tx/signing/aminojson renders a
|
|
16
|
+
// set oneof member as
|
|
17
|
+
//
|
|
18
|
+
// "<CamelCase oneof name>": {"type": "<oneof_name>", "value": {"<field>": {...}}}
|
|
19
|
+
//
|
|
20
|
+
// e.g. "Payload": {"type": "sparkdream/session/RecurringPullPayload",
|
|
21
|
+
// "value": {"recurring_pull": {...}}}
|
|
22
|
+
//
|
|
23
|
+
// while telescope emits the bare member ("recurring_pull": {...}).
|
|
24
|
+
// 3. Repeated fields must be omitted when empty (omitempty), never `[]`.
|
|
25
|
+
//
|
|
26
|
+
// cosmjs rebuilds the TxBody from fromAmino(signed msgs), so each fromAmino
|
|
27
|
+
// below must exactly invert its toAmino.
|
|
28
|
+
//
|
|
29
|
+
// 64-bit ints are coerced here rather than trusting callers to pass BigInt:
|
|
30
|
+
// cosmjs hands toAmino the caller's raw value (no fromPartial), and a Number
|
|
31
|
+
// 0 would otherwise sign a key the chain omits.
|
|
7
32
|
import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreateSession, MsgRevokeSession, } from "./tx";
|
|
8
33
|
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
|
9
34
|
import { Timestamp } from "../../../google/protobuf/timestamp";
|
|
10
|
-
import { toTimestamp } from "../../../helpers";
|
|
35
|
+
import { toTimestamp, fromTimestamp } from "../../../helpers";
|
|
11
36
|
import { anyToAmino, aminoToAny } from "../../../nested-amino";
|
|
37
|
+
const str = (v) => (v === "" || v === undefined || v === null ? undefined : v);
|
|
38
|
+
const int64 = (v) => {
|
|
39
|
+
if (v === undefined || v === null || v === "")
|
|
40
|
+
return undefined;
|
|
41
|
+
const b = BigInt(v);
|
|
42
|
+
return b === BigInt(0) ? undefined : b.toString();
|
|
43
|
+
};
|
|
44
|
+
const bool = (v) => (v ? true : undefined);
|
|
45
|
+
const list = (v) => ((v?.length ?? 0) > 0 ? v.map((e) => e) : undefined);
|
|
46
|
+
const coin = (v) => (v ? Coin.toAmino(Coin.fromPartial(v)) : undefined);
|
|
47
|
+
const time = (v) => (v ? Timestamp.toAmino(toTimestamp(v)) : undefined);
|
|
48
|
+
const toBig = (v) => (v === undefined || v === null ? BigInt(0) : BigInt(v));
|
|
49
|
+
const fromCoin = (v) => (v ? Coin.fromAmino(v) : undefined);
|
|
50
|
+
const fromTime = (v) => (v ? fromTimestamp(Timestamp.fromAmino(v)) : undefined);
|
|
51
|
+
// ── Payloads ────────────────────────────────────────────────────────────
|
|
52
|
+
const sessionKeyToAmino = (p) => ({
|
|
53
|
+
allowed_msg_types: list(p.allowedMsgTypes),
|
|
54
|
+
spend_limit: coin(p.spendLimit),
|
|
55
|
+
spent: coin(p.spent),
|
|
56
|
+
max_exec_count: int64(p.maxExecCount),
|
|
57
|
+
exec_count: int64(p.execCount),
|
|
58
|
+
last_used_at: time(p.lastUsedAt),
|
|
59
|
+
allow_self_revoke: bool(p.allowSelfRevoke),
|
|
60
|
+
});
|
|
61
|
+
const sessionKeyFromAmino = (o) => ({
|
|
62
|
+
allowedMsgTypes: o.allowed_msg_types ?? [],
|
|
63
|
+
spendLimit: fromCoin(o.spend_limit),
|
|
64
|
+
spent: fromCoin(o.spent),
|
|
65
|
+
maxExecCount: toBig(o.max_exec_count),
|
|
66
|
+
execCount: toBig(o.exec_count),
|
|
67
|
+
lastUsedAt: fromTime(o.last_used_at),
|
|
68
|
+
allowSelfRevoke: o.allow_self_revoke ?? false,
|
|
69
|
+
});
|
|
70
|
+
const recurringPullToAmino = (p) => ({
|
|
71
|
+
amount_per_period: coin(p.amountPerPeriod),
|
|
72
|
+
period_seconds: int64(p.periodSeconds),
|
|
73
|
+
start_time: int64(p.startTime),
|
|
74
|
+
last_claim_advance: int64(p.lastClaimAdvance),
|
|
75
|
+
claims_made: int64(p.claimsMade),
|
|
76
|
+
max_per_epoch: str(p.maxPerEpoch),
|
|
77
|
+
});
|
|
78
|
+
const recurringPullFromAmino = (o) => ({
|
|
79
|
+
amountPerPeriod: fromCoin(o.amount_per_period),
|
|
80
|
+
periodSeconds: toBig(o.period_seconds),
|
|
81
|
+
startTime: toBig(o.start_time),
|
|
82
|
+
lastClaimAdvance: toBig(o.last_claim_advance),
|
|
83
|
+
claimsMade: toBig(o.claims_made),
|
|
84
|
+
maxPerEpoch: o.max_per_epoch ?? "",
|
|
85
|
+
});
|
|
86
|
+
const spendingAllowanceToAmino = (p) => ({
|
|
87
|
+
max_per_period: coin(p.maxPerPeriod),
|
|
88
|
+
period_seconds: int64(p.periodSeconds),
|
|
89
|
+
current_period_start: int64(p.currentPeriodStart),
|
|
90
|
+
spent_in_current_period: coin(p.spentInCurrentPeriod),
|
|
91
|
+
allowed_recipients: list(p.allowedRecipients),
|
|
92
|
+
denom: str(p.denom),
|
|
93
|
+
});
|
|
94
|
+
const spendingAllowanceFromAmino = (o) => ({
|
|
95
|
+
maxPerPeriod: fromCoin(o.max_per_period),
|
|
96
|
+
periodSeconds: toBig(o.period_seconds),
|
|
97
|
+
currentPeriodStart: toBig(o.current_period_start),
|
|
98
|
+
spentInCurrentPeriod: fromCoin(o.spent_in_current_period),
|
|
99
|
+
allowedRecipients: o.allowed_recipients ?? [],
|
|
100
|
+
denom: o.denom ?? "",
|
|
101
|
+
});
|
|
102
|
+
const scheduledOneshotToAmino = (p) => {
|
|
103
|
+
let action = undefined;
|
|
104
|
+
if (p.transfer) {
|
|
105
|
+
action = {
|
|
106
|
+
type: "sparkdream/session/OneshotTransfer",
|
|
107
|
+
value: { transfer: { recipient: str(p.transfer.recipient), amount: coin(p.transfer.amount) } },
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
else if (p.exec) {
|
|
111
|
+
action = {
|
|
112
|
+
type: "sparkdream/session/OneshotExec",
|
|
113
|
+
value: {
|
|
114
|
+
exec: {
|
|
115
|
+
msg: p.exec.msg ? anyToAmino(p.exec.msg) : undefined,
|
|
116
|
+
gas_limit: int64(p.exec.gasLimit),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
// aminojson writes `null` for an unset oneof rather than omitting it.
|
|
123
|
+
Action: action ?? null,
|
|
124
|
+
fire_at: int64(p.fireAt),
|
|
125
|
+
fire_error: str(p.fireError),
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const scheduledOneshotFromAmino = (o) => {
|
|
129
|
+
const v = o.Action?.value ?? {};
|
|
130
|
+
return {
|
|
131
|
+
transfer: v.transfer
|
|
132
|
+
? { recipient: v.transfer.recipient ?? "", amount: fromCoin(v.transfer.amount) }
|
|
133
|
+
: undefined,
|
|
134
|
+
exec: v.exec
|
|
135
|
+
? { msg: v.exec.msg ? aminoToAny(v.exec.msg) : undefined, gasLimit: toBig(v.exec.gas_limit) }
|
|
136
|
+
: undefined,
|
|
137
|
+
fireAt: toBig(o.fire_at),
|
|
138
|
+
fireError: o.fire_error ?? "",
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const PAYLOADS = [
|
|
142
|
+
["sessionKey", "session_key", "sparkdream/session/SessionKeyPayload", sessionKeyToAmino, sessionKeyFromAmino],
|
|
143
|
+
["recurringPull", "recurring_pull", "sparkdream/session/RecurringPullPayload", recurringPullToAmino, recurringPullFromAmino],
|
|
144
|
+
["spendingAllowance", "spending_allowance", "sparkdream/session/SpendingAllowancePayload", spendingAllowanceToAmino, spendingAllowanceFromAmino],
|
|
145
|
+
["scheduledOneshot", "scheduled_oneshot", "sparkdream/session/ScheduledOneshotPayload", scheduledOneshotToAmino, scheduledOneshotFromAmino],
|
|
146
|
+
];
|
|
147
|
+
// ── Messages ────────────────────────────────────────────────────────────
|
|
148
|
+
// {<signer>, grant_id} messages; each signer field name is a single word, so
|
|
149
|
+
// the proto and amino spellings coincide.
|
|
150
|
+
const grantIdMsg = (signer) => ({
|
|
151
|
+
toAmino: (m) => ({ [signer]: str(m[signer]), grant_id: int64(m.grantId) }),
|
|
152
|
+
fromAmino: (o) => ({ [signer]: o[signer] ?? "", grantId: toBig(o.grant_id) }),
|
|
153
|
+
});
|
|
12
154
|
export const AminoConverter = {
|
|
13
155
|
"/sparkdream.session.v1.MsgUpdateParams": {
|
|
14
156
|
aminoType: "sparkdream/x/session/MsgUpdateParams",
|
|
@@ -64,4 +206,64 @@ export const AminoConverter = {
|
|
|
64
206
|
};
|
|
65
207
|
},
|
|
66
208
|
},
|
|
209
|
+
"/sparkdream.session.v1.MsgCreateGrant": {
|
|
210
|
+
aminoType: "sparkdream/x/session/MsgCreateGrant",
|
|
211
|
+
toAmino(message) {
|
|
212
|
+
const set = PAYLOADS.find(([key]) => message[key]);
|
|
213
|
+
return {
|
|
214
|
+
granter: str(message.granter),
|
|
215
|
+
grantee: str(message.grantee),
|
|
216
|
+
expires_at: time(message.expiresAt),
|
|
217
|
+
note: str(message.note),
|
|
218
|
+
Payload: set
|
|
219
|
+
? { type: set[2], value: { [set[1]]: set[3](message[set[0]]) } }
|
|
220
|
+
: null,
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
fromAmino(object) {
|
|
224
|
+
const out = {
|
|
225
|
+
granter: object.granter ?? "",
|
|
226
|
+
grantee: object.grantee ?? "",
|
|
227
|
+
expiresAt: fromTime(object.expires_at),
|
|
228
|
+
note: object.note ?? "",
|
|
229
|
+
};
|
|
230
|
+
const inner = object.Payload?.value ?? {};
|
|
231
|
+
for (const [key, field, , , fromAmino] of PAYLOADS) {
|
|
232
|
+
if (inner[field])
|
|
233
|
+
out[key] = fromAmino(inner[field]);
|
|
234
|
+
}
|
|
235
|
+
return out;
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
"/sparkdream.session.v1.MsgClaimRecurringPull": {
|
|
239
|
+
aminoType: "sparkdream/x/session/MsgClaimRecurringPull",
|
|
240
|
+
...grantIdMsg("grantee"),
|
|
241
|
+
},
|
|
242
|
+
"/sparkdream.session.v1.MsgPullAllowance": {
|
|
243
|
+
aminoType: "sparkdream/x/session/MsgPullAllowance",
|
|
244
|
+
toAmino: (m) => ({
|
|
245
|
+
grantee: str(m.grantee),
|
|
246
|
+
grant_id: int64(m.grantId),
|
|
247
|
+
recipient: str(m.recipient),
|
|
248
|
+
amount: coin(m.amount),
|
|
249
|
+
}),
|
|
250
|
+
fromAmino: (o) => ({
|
|
251
|
+
grantee: o.grantee ?? "",
|
|
252
|
+
grantId: toBig(o.grant_id),
|
|
253
|
+
recipient: o.recipient ?? "",
|
|
254
|
+
amount: fromCoin(o.amount),
|
|
255
|
+
}),
|
|
256
|
+
},
|
|
257
|
+
"/sparkdream.session.v1.MsgRetryScheduledOneshot": {
|
|
258
|
+
aminoType: "sparkdream/x/session/MsgRetryScheduledOneshot",
|
|
259
|
+
...grantIdMsg("caller"),
|
|
260
|
+
},
|
|
261
|
+
"/sparkdream.session.v1.MsgRevokeGrant": {
|
|
262
|
+
aminoType: "sparkdream/x/session/MsgRevokeGrant",
|
|
263
|
+
...grantIdMsg("granter"),
|
|
264
|
+
},
|
|
265
|
+
"/sparkdream.session.v1.MsgDeclineGrant": {
|
|
266
|
+
aminoType: "sparkdream/x/session/MsgDeclineGrant",
|
|
267
|
+
...grantIdMsg("grantee"),
|
|
268
|
+
},
|
|
67
269
|
};
|